-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AesGcm as as drop-in for OpenSSL: encryption by chunks #497
Comments
We absolutely will not be supporting an incremental decryption API as those reveal unauthenticated decrypts of ciphertexts which break AEAD security. That is an OpenSSL design flaw. There is no safe way to do it. Any design opens you up to CCAs. As for incremental/online encryption, that's something we won't support in We do have this open issue on the traits repo for AAD streaming specifically: RustCrypto/traits#62 I would suggest opening another one for the online encryption use case as it seems we don't currently have an open one. That said, I'm closing this issue as we will not be adding further bespoke APIs to individual crates without a well-designed trait-based interface. See also: the provably secure |
Thank you for the very thorough explanation. I'll read a bit more into this then open the issue as you recommended and take a look into how to design something that fits into my available API |
I opened RustCrypto/traits#1364 to track a full incremental encryption API |
Is it possible to "encrypt by chunks" in the way that you can for openssl?
I am trying to do a drop in replacement for something like this example, where unencrypted input data that comes in blocks is used to incrementally update the output. this is a GCM-specific example but the below is a good enough example for something similar:
It seems like as far as mappings go:
EVP_CIPHER_CTX_init
andEVP_CipherInit_ex
are both wrapped intoAes256Gcm::new(&key)
, and what is callediv
in openssl isnonce
in RustCrypto. This must be provided with each encrypt/decrypt operation, seems like openssl keeps it in the contextThe closest thing to
EVP_CipherUpdate
looks likeencrypt_in_place_detached
, but this returns a tag, and I'm not sure what happens to thenonce
. What is the proper way to encrypt block by block? It seems like maybe the following pseudocode would work:And then decryption would first read the nonce, then decrypt block by block (block size would have to be identical here). Is this the correct way to perform this task?
It seems like the correct way would mean only writing a single tag at the end, but I can't figure out how to do this.
The text was updated successfully, but these errors were encountered: