Improves/security#132
Conversation
| } | ||
| nonce := b[:aead.NonceSize()] | ||
| cipher := aead.Seal(nil, nonce, b[aead.NonceSize():], nil) | ||
| // The nonce must be unique for all time, for a given key |
There was a problem hiding this comment.
our code relies on these deterministic nonce for now?
There was a problem hiding this comment.
no. with the old code, the nonce was the first 12 bytes of plaintext, but decrypt just used it for GCM authentication and reconstructed the plaintext by prepending it back. And it's only used for decrypt
There was a problem hiding this comment.
How about the old already encrypted data in the network.
| panic(err) | ||
| } | ||
| return append(nonce, d...) | ||
| return d |
There was a problem hiding this comment.
will this break the code if the decrypted data changes?
There was a problem hiding this comment.
no. the original plaintext would be decrypted and returned by aead.Open(), the changes of AESEncrypt and AESDecrypt only change the process of encrypt and decrypt. The both functions are used in many test codes.
No description provided.