You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
https://downloads.bouncycastle.org/java/docs/bcprov-jdk18on-javadoc/org/bouncycastle/crypto/engines/Grain128AEADEngine.html fails to decrypt when using a wrapping function that works with Ascon and Elephant AEAD ciphers (padded plaintext is successfully reversed, 16 bytes of what I assume to be a MAC are appended).
In the following sample, the first line is the plaintext, the second line is the padded plaintext, the third line is the ciphertext, and the fourth line is the plaintext post-decryption (notice the trailing bytes). All lines are encoded in hexadecimal.
Thank you for highlighting the decryption issue with the Grain128AEADEngine, which did not correctly handle MAC generation and verification during decryption. This issue has now been fixed. Please check the update in GitHub or the latest beta version.
If you have further questions or need assistance, feel free to reach out.
In version 1.80:
https://downloads.bouncycastle.org/java/docs/bcprov-jdk18on-javadoc/org/bouncycastle/crypto/engines/Grain128AEADEngine.html fails to decrypt when using a wrapping function that works with Ascon and Elephant AEAD ciphers (padded plaintext is successfully reversed, 16 bytes of what I assume to be a MAC are appended).
In the following sample, the first line is the plaintext, the second line is the padded plaintext, the third line is the ciphertext, and the fourth line is the plaintext post-decryption (notice the trailing bytes). All lines are encoded in hexadecimal.
Looking at https://github.com/bcgit/bc-java/blob/main/core/src/test/java/org/bouncycastle/crypto/test/Grain128AEADTest.java, I do not see tests of decryption (no
.init(false...)
calls).Looking at https://github.com/bcgit/bc-java/blob/main/core/src/main/java/org/bouncycastle/crypto/engines/Grain128AEADEngine.java#L379, it seems
.doFinal()
is not checking whether or not it is supposed to be encrypting or decrypting, and always emits a MAC.Looking at https://grain-128aead.github.io/, it seems this cipher is in the process of standardization, and I am not aware of this fact's effects on the workings of the cipher in Bouncy Castle.
It is of course possible that my implementation is not correctly decrypting, and there is no issue with Grain-128AEAD's implementation.
The text was updated successfully, but these errors were encountered: