forked from quic-go/quic-go
implement header encrytion and decryption for sealers and openers
This commit is contained in:
@@ -21,8 +21,8 @@ func newInitialAEAD(connID protocol.ConnectionID, pers protocol.Perspective) (Se
|
||||
mySecret = serverSecret
|
||||
otherSecret = clientSecret
|
||||
}
|
||||
myKey, _, myIV := computeInitialKeyAndIV(mySecret)
|
||||
otherKey, _, otherIV := computeInitialKeyAndIV(otherSecret)
|
||||
myKey, myPNKey, myIV := computeInitialKeyAndIV(mySecret)
|
||||
otherKey, otherPNKey, otherIV := computeInitialKeyAndIV(otherSecret)
|
||||
|
||||
encrypterCipher, err := aes.NewCipher(myKey)
|
||||
if err != nil {
|
||||
@@ -32,6 +32,10 @@ func newInitialAEAD(connID protocol.ConnectionID, pers protocol.Perspective) (Se
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
pnEncrypter, err := aes.NewCipher(myPNKey)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
decrypterCipher, err := aes.NewCipher(otherKey)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@@ -40,7 +44,11 @@ func newInitialAEAD(connID protocol.ConnectionID, pers protocol.Perspective) (Se
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
return newSealer(encrypter, myIV), newOpener(decrypter, otherIV), nil
|
||||
pnDecrypter, err := aes.NewCipher(otherPNKey)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
return newSealer(encrypter, myIV, pnEncrypter, false), newOpener(decrypter, otherIV, pnDecrypter, false), nil
|
||||
}
|
||||
|
||||
func computeSecrets(connID protocol.ConnectionID) (clientSecret, serverSecret []byte) {
|
||||
|
||||
Reference in New Issue
Block a user