2 ms·
It's a really good question, because, in order to verify the AD, you have to have the same key you need to decrypt it.
by tptacek 2y ago
It's a really good question, because, in order to verify the AD, you have to have the same key you need to decrypt it.
- stavros 2y agoYep, that's the part that throws me. Is it fair to say that it's a more elegant way to include metadata in the ciphertext, without really messing with the plaintext itself? Ie it's basically "just" a way to distinguish the message from its metadata?
- edoceo 2y agoDoes that make it like some kind of HMAC?
- hxtk 2y agoYes, in fact, one construction of the AEAD primitive is to use AES-CTR with HMAC to "bolt on" authentication after the fact (AES-CTR on its own is an unauthenticated stream cipher). You can find an implementation of AES-CTR-HMAC (at a high level where AES-CTR and HMAC are both given) here: https://github.com/tink-crypto/tink-go/blob/main/aead/aesctrhmac/aead.go#L75 https://github.com/tink-crypto/tink-go/blob/main/aead/aesctr...