Allow MessageEncryptor to take advantage authenticated encryption modes#25874
Allow MessageEncryptor to take advantage authenticated encryption modes#25874bdewater wants to merge 5 commits intorails:masterfrom
Conversation
|
Dig it! Can you ensure compatibility with MessageEncryptor that already use an AEAD cipher? |
|
That could probably work by counting the |
b351f7e to
9b476e5
Compare
AEAD modes like `aes-256-gcm` provide both confidentiality and data authenticity, eliminating the need to use MessageVerifier to check if the encrypted data has been tampered with.
9b476e5 to
d38cd27
Compare
|
@jeremy that should not work right now. MessageVerifier will tell that the message is valid but I've also done a quick test with aes-256-ccm (the only other AEAD chipher on my system with OpenSSL 1.0.2h according to Edit: already fixed in Ruby trunk at ruby/ruby@9f70378 |
Using `aes-256-ccm` as a cipher on Ruby 2.3.1 results in "OpenSSL::Cipher::CipherError: authentication tag not supported by this cipher" even though it is an authenticated mode: https://wiki.openssl.org/index.php/EVP_Authenticated_Encryption_and_Decryption#Authenticated_Encryption_using_CCM_mode - the same will probably be true for `chacha20-poly1305` when OpenSSL 1.1.0 is released without a fix upstream in the bindings..
d38cd27 to
5d5f291
Compare
5d5f291 to
41cb447
Compare
activesupport/CHANGELOG.md
Outdated
| @@ -1,3 +1,12 @@ | |||
| * Allow MessageEncryptor to take advantage authenticated encryption modes. | |||
|
Squashed in d4ea18a |
|
We should be adding a note that, switching modes busts previous auth messages that were set with current environment. |
|
Hmm, nevermind, I don't see how this will affect existing auth |
…hen rails#25874 was squashed before merging [skip ci]
AEAD modes have been supported since Ruby 2.0 (doc) and OpenSSL 1.0.1. It is faster:
And it produces smaller ciphertexts: