Add support for authenticated encryption/decryption using OpenSSL #4593
Labels
help wanted
This issue is generally accepted and needs someone to pick it up
kind:feature
topic:stdlib:crypto
As it stands, Crystal doesn't support authenticated encryption/decryption using the OpenSSL::Cipher module.
According to
https://wiki.openssl.org/index.php/EVP_Authenticated_Encryption_and_Decryption
we need to be able to:
.set custom IV length? (not sure when this would be used, research)
.add AAD (authenticated data) using EVP_EncryptUpdate
.get/set the authentication tag with EVP_CIPHER_CTX_ctrl
I don't mind writing the code for this, but suggestions are welcome as to organization/naming.
An update_aad function could be used to set authenticated data.
I could use the iv_len call still, and just make an iv_len= call to set a custom IV lenggth.
Similarly, authentication_tag and authentication_tag= calls could get/set the authentication tag.
It looks like this will work for CCM and GCM AES modes.
Any thoughts?
The text was updated successfully, but these errors were encountered: