jeroen / openssl

OpenSSL bindings for R
Other
64 stars 22 forks source link

Tags in GCM aren't verified on decryption #73

Open laborg opened 5 years ago

laborg commented 5 years ago

It appears that the tags usually appended to the ciphertext aren't verified. At least the code in aes.c doesn't look like it handles tags at all. I think it would be good to either a) follow other other APIs (e.g. Java) and expect the tag to be appended and use it for verification. or b) allow the user to supply the tag

Example implementation, using tags to verify the ciphertext: https://wiki.openssl.org/images/0/08/Evp-gcm-encrypt.c

Information about the usual location of tags: https://crypto.stackexchange.com/questions/25249/where-is-the-authentication-tag-stored-in-file-encrypted-using-aes-gcm