Replies: 2 comments
-
No, libsodium doesn't allow applications to get a message, even partially, prior to having checked that it wasn't tampered with. You need to split the message into pieces, and encrypt each piece individually. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your answer. At least this clearly tells me to not spend more time trying to find something which Regarding chunking the messages I can't really do that, since this would be limit my options to implement video streams: One question that I have, the Thanks for your help. |
Beta Was this translation helpful? Give feedback.
-
I am looking for a way to decrypt/encrypt big files (in ranges of GB) without allocating that much memory. I wouldn't like to give up the authentication checks.
I am also looking to use my IV instead of a random one (This requirement is because on my side the encryption logic is already being given the Nonce/Key which is stored separately in object metadata instead of file contents).
This API: https://doc.libsodium.org/secret-key_cryptography/secretstream appends the
17 bytes
(authentication tag?) every time:crypto_secretstream_xchacha20poly1305_pull
is being called and doesn't seem to allow to initialize custom IV.This API on the other hand doesn't give option to authenticate streams: https://doc.libsodium.org/advanced/stream_ciphers/xchacha20
I am coming from AES-GCM background which is also an authenticated streaming cipher and such operations are supported in its ecosystem.
I am failing to find such option with
libsodium
for XChaCha20-Poly1305.Is such use case supported?
In other words is it possible to decrypt/encrypt stream and use single authentication tag at the end?
Is it possible to initalize the IV without giving up the:
Poly1305
part?With Python you can initialize nonce, stream ciphertext (technically even up to 64GB AES limit) and sign with a single authentication tag at the end.
With Bouncycastle you can achieve the same using:
processBytes
anddoFinal
methods.Please find code code samples below, which demonstrate such possibility with AES-GCM.
Beta Was this translation helpful? Give feedback.
All reactions