switch to AES-GCM as symmetric cipher

fixes #200
This commit is contained in:
Lucas Clemente
2016-07-05 12:13:36 +02:00
parent 1fc83757a0
commit 705da8fd00
9 changed files with 312 additions and 87 deletions

View File

@@ -71,7 +71,7 @@ func NewCryptoSetup(
scfg: scfg,
nonce: nonce,
diversificationNonce: diversificationNonce,
keyDerivation: crypto.DeriveKeysChacha20,
keyDerivation: crypto.DeriveKeysAESGCM,
keyExchange: crypto.NewCurve25519KEX,
cryptoStream: cryptoStream,
connectionParametersManager: connectionParametersManager,

View File

@@ -47,7 +47,7 @@ func (s *ServerConfig) Get() []byte {
WriteHandshakeMessage(&serverConfig, TagSCFG, map[Tag][]byte{
TagSCID: s.ID,
TagKEXS: []byte("C255"),
TagAEAD: []byte("CC20"),
TagAEAD: []byte("AESG"),
TagPUBS: append([]byte{0x20, 0x00, 0x00}, s.kex.PublicKey()...),
TagOBIT: {0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7},
TagEXPY: {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},

View File

@@ -24,7 +24,7 @@ var _ = Describe("ServerConfig", func() {
})
It("gets the proper binary representation", func() {
expected := bytes.NewBuffer([]byte{0x53, 0x43, 0x46, 0x47, 0x7, 0x0, 0x0, 0x0, 0x56, 0x45, 0x52, 0x0, 0x4, 0x0, 0x0, 0x0, 0x41, 0x45, 0x41, 0x44, 0x8, 0x0, 0x0, 0x0, 0x53, 0x43, 0x49, 0x44, 0x18, 0x0, 0x0, 0x0, 0x50, 0x55, 0x42, 0x53, 0x3b, 0x0, 0x0, 0x0, 0x4b, 0x45, 0x58, 0x53, 0x3f, 0x0, 0x0, 0x0, 0x4f, 0x42, 0x49, 0x54, 0x47, 0x0, 0x0, 0x0, 0x45, 0x58, 0x50, 0x59, 0x4f, 0x0, 0x0, 0x0, 0x51, 0x30, 0x33, 0x32, 0x43, 0x43, 0x32, 0x30})
expected := bytes.NewBuffer([]byte{0x53, 0x43, 0x46, 0x47, 0x7, 0x0, 0x0, 0x0, 0x56, 0x45, 0x52, 0x0, 0x4, 0x0, 0x0, 0x0, 0x41, 0x45, 0x41, 0x44, 0x8, 0x0, 0x0, 0x0, 0x53, 0x43, 0x49, 0x44, 0x18, 0x0, 0x0, 0x0, 0x50, 0x55, 0x42, 0x53, 0x3b, 0x0, 0x0, 0x0, 0x4b, 0x45, 0x58, 0x53, 0x3f, 0x0, 0x0, 0x0, 0x4f, 0x42, 0x49, 0x54, 0x47, 0x0, 0x0, 0x0, 0x45, 0x58, 0x50, 0x59, 0x4f, 0x0, 0x0, 0x0, 0x51, 0x30, 0x33, 0x32, 'A', 'E', 'S', 'G'})
expected.Write(scfg.ID)
expected.Write([]byte{0x20, 0x0, 0x0})
expected.Write(kex.PublicKey())