Let me guess. Not flushing/closing the stream?

On Oct 3, 2019, at 8:41 PM, Benoit Laforest <benoit.lafor...@ubisoft.com> wrote:


Hi,

Ok, I found my problem, it was a dumb-and-very-hard-to-see error on my side…

Every thing works now. 😊 Yay.

Benoit


De : Benoit Laforest <benoit.lafor...@ubisoft.com>
Envoyé : 3 octobre 2019 17:25
À : dev-crypto-csharp@bouncycastle.org
Objet : [dev-crypto-csharp] HELP: stuck with the exception "mac check in GCM 
failed" during decryption

Hi,

I am testing the decryption with the GcmCypherBlock and I am totally stuck with 
the exception “mac check in GCM failed” when I call DoFinal().


  *   The encryption does not generate any problem, and I use the same secret 
symmetric key, public IV and additional text in the Aead param for both 
encryption and decryption.  I also performed the DH exchange correctly wih the 
X25519 agreement to compute my symmetric key.


  *   I use a 128 bit IV and mac and a 256 bits key size


  *   I also tried this code sample from this web site to compare and it worked 
fine: 
https://codereview.stackexchange.com/questions/110952/bouncycastle-diffie-hellman


  *   I event tried this code sample with the X25519 and using the same  
“secret message” and it still worked…

So now I am a bit clueless as to what can go wrong.

Thanks,

Benoit

Reply via email to