Modern Session Encryption
David Wong
Modern Session Encryption David Wong outline 3. NOISE 2. STROBE - - PowerPoint PPT Presentation
Modern Session Encryption David Wong outline 3. NOISE 2. STROBE 4. ??? 1. KECCAK Sponge Construction 00101 01001 01100 11001 01011 10101 0 0 0 0 f f f f f 0 0 0 0 absorbing squeezing Duplex Construction input
David Wong
f
⊕ ⊕
f
⊕
f f f
squeezing
Sponge Construction
absorbing
00101 01001 01100 11001 01011 10101
f
input
⊕
init
duplexing
Duplex Construction
f
input
⊕
duplexing
f
input
duplexing
⊕
Keyed-mode
f
key
⊕
init duplexing
f
key
⊕
init duplexing
Encryption?
f
key
⊕
init duplexing
ciphertext1 plaintext1
⊕
Encryption
f
key
⊕
init duplexing
ciphertext1 plaintext1
⊕
f
⊕
tag1
duplexing
Authenticated Encryption
f
key
⊕
init duplexing
ciphertext1 plaintext1
⊕
f
⊕
tag1
duplexing
f
ciphertext2
duplexing
f
⊕
tag2
duplexing
plaintext2
⊕
Sessions
f
key ⊕
init duplexingciphertext1 plaintext1 ⊕
f
⊕ tag1
duplexingf
ciphertext2
duplexingf
⊕ tag2
duplexingplaintext2 ⊕
f
ciphertext3
duplexingf
⊕ tag3
duplexingplaintext3 ⊕
f
ciphertext4
duplexingf
⊕ tag4
duplexingplaintext4 ⊕
⊕
data = 010100…
⊕
AD
⊕
data = 010100…
KEY
f
⊕
00000…
PRF
f
⊕
data = 010100…
⊕
send_CLR
⊕
data = 010100…
⊕
recv_CLR
⊕
ciphertext
send_ENC
f
plaintext
⊕
⊕
tag
send_MAC
f
⊕
RATCHET
f
0000
⊕
plaintext
recv_ENC
f
⊕
ciphertext
⊕
recv_MAC
f
0000…
⊕
tag
myProtocol = Strobe_init(“myWebsite.com”) myProtocol.AD(sharedSecret) buffer = myProtocol.send_ENC(“GET /”) buffer += myProtocol.send_MAC(len=16) // send the buffer // receive a ciphertext message = myProtocol.recv_ENC(ciphertext[:-16])
if !ok { // reset the connection }
Strobe protocol example
buffer = myProtocol.send_ENC(plaintext1) buffer += myProtocol.send_MAC(len=16) // send the buffer buffer = myProtocol.send_ENC(plaintext2) buffer += myProtocol.send_MAC(len=16) // send the buffer buffer = myProtocol.send_ENC(plaintext3) buffer += myProtocol.send_MAC(len=16) // send the buffer buffer = myProtocol.send_ENC(plaintext4) buffer += myProtocol.send_MAC(len=16) // send the buffer
⊕
rate capacity
⊕
data = 010100…
⊕
rate capacity
⊕
data = 010100…
⊕
⊕
rate capacity
⊕
data = 010100…
f
⊕
⊕
rate capacity
⊕
data = 010100…
f
⊕
data = hello
⊕
ciphertext
⊕
rate capacity
⊕
data = 010100…
f f
⊕
data = hello
⊕
ciphertext
len = 16 tag
⊕
⊕
rate capacity
⊕
data = 010100…
f f
⊕
data = hello
⊕
ciphertext
len = 16 tag
⊕
send_AEAD
⊕
rate capacity
strobe.sourceforge.io
Complexity is the enemy of security
www.noiseprotocol.org
ephemeral key ephemeral key Client Server
handshake
ephemeral key ephemeral key Client Server
handshake
Diffie-Hellman() Diffie-Hellman() keys keys
ephemeral key ephemeral key Client Server
handshake
encrypted data encrypted data
post-handshake
Diffie-Hellman() Diffie-Hellman() keys keys
e e Client Server
handshake
encrypted data encrypted data
post-handshake
ee ee keys keys
→ e ← e, ee NN(): ← s … → e, es ← e, ee NK(rs): → e ← e, ee, s, es NX(rs): → e ← e, ee → s, se XN(s): ← s → s … → e, es, ss ← e, ee, se KK(s, rs): → e ← e, ee, s, es → s, se XX(s, rs): ← s … → e, es N(rs): ← s → s … → e, es, ss K(s,rs): ← s … → e, es, s, ss X(s,rs): ← s … → e, es ← e, ee → s, se XK(s, rs): → s … → e ← e, ee, se KN(s):
NX(rs): → e ← e, ee, s, es
Client Server
epublic Client Server
NX(rs): → e ← e, ee, s, es
payload1 epublic Client Server
NX(rs): → e ← e, ee, s, es
republic epublic Client Server payload1
NX(rs): → e ← e, ee, s, es
republic epublic Client Server payload1
NX(rs): → e ← e, ee, s, es
republic EK1(rs) epublic Client Server payload1
NX(rs): → e ← e, ee, s, es
republic EK1(rs) epublic Client Server payload1
NX(rs): → e ← e, ee, s, es
republic EK1(rs) EK2(payload2) epublic Client Server payload1
NX(rs): → e ← e, ee, s, es
HandshakeState SymmetricState CipherState
epublic payload1 republic Ek1(rspublic)
HKDF
DH(e, re)
ck n=0 k1 e
GENERATE_KEYPAIR()
Initialization
ck h
“Noise_NX_25519_AESGCM_SHA256”
HASH
h e.public_key
HASH
re.public_key
HASH
h rs
DecryptWithAd() Ek1(rspublic)
h
HASH
h
Ek1(rspublic) HASH
h
payload1
CipherState
HKDF
k k n=0 n=0 CipherState
Ek2(payload2)
re
republic HKDF
DH(e, rs)
ck n=0 k2
DecryptWithAd() Ek2(payload2)
h
payload2 HASH
h
Ek2(payload2)
HandshakeState StrobeState
epublic payload1 republic E(rspublic) Initialization E(payload2)
InitStrobe()
“Noise_NX_25519_Strobe”
e
GENERATE_KEYPAIR() send_CLR() payload1 send_CLR()
e.public_key re.public_key
recv_CLR() republic recv_AEAD() E(payload2) payload2 AD()
DH(e, rs)
rs.public_key
recv_AEAD() E(rspublic)
StrobeState StrobeState
… …
AD()
DH(e, re)
StrobeState
send_AEAD() send_AEAD() send_AEAD() send_AEAD() send_AEAD() send_AEAD() send_AEAD()
StrobeState
recv_AEAD() recv_AEAD() recv_AEAD() recv_AEAD() recv_AEAD() recv_AEAD() recv_AEAD()
HandshakeState StrobeState
epublic payload1 republic E(rspublic), tag1 E(payload2), tag2
e
GENERATE_KEYPAIR()
Initialization
“Noise_NX_25519_Strobe”
⊕
e.public_key
⊕
payload1
⊕
DH(e, re)
⊕
DH(e, rs)
⊕
re.public_key
⊕
republic tag1
rs.public_key
E(rspublic)
⊕
rs.public_key
E(payload2)
⊕
tag2
www.discocrypto.com
700,000 LOC
disco-c libdisco (go) OpenSSL
4,000 LOC 1,000 LOC 2,000 LOC
DiscoNet* (C#)
* implementation by Artyom Makarov
DISCO STROBE X25519 KECCAK-F
Trust Graph of Disco
Trust Graph of biased SSL/TLS
TLS 1.3 HMAC X25519 SHA-256 HKDF ECDSA AES-GCM
Trust Graph of SSL/TLS
TLS 1.3 HMAC SHA-256 SHA-384 SHA-512 HKDF ECDSA AES-GCM DH ECDH CHACHA20- POLY1305 TLS 1.2 TLS 1.1 X.509 ASN.1 DER secp256r1 secp384r1 secp521r1 ffdhe2048 X25519 X448 ffdhe3072 ffdhe4096 ffdhe6144 ffdhe8192 RSA-PSS or RSA-PKCS#1 v1.5 AES-CCM ed25519 ed448
the disco is at www.discocrypto.com I write about crypto www.cryptologie.net follow me on twitter.com/cryptodavidw
(and I work here)