MAC check failed

Issue #328 resolved
Paulo Salgado created an issue

Hi guys!

I just started using Nimbus-Jose-JWT and I’m receiving the following exception, while trying to decrypt a token:

com.nimbusds.jose.JOSEException: MAC check failed
    at com.nimbusds.jose.crypto.impl.AESCBC.decryptAuthenticated(AESCBC.java:357) ~[nimbus-jose-jwt-7.1.jar:7.1]
    at com.nimbusds.jose.crypto.impl.ContentCryptoProvider.decrypt(ContentCryptoProvider.java:266) ~[nimbus-jose-jwt-7.1.jar:7.1]
    at com.nimbusds.jose.crypto.DirectDecrypter.decrypt(DirectDecrypter.java:271) ~[nimbus-jose-jwt-7.1.jar:7.1]
    at com.nimbusds.jose.JWEObject.decrypt(JWEObject.java:415) ~[nimbus-jose-jwt-7.1.jar:7.1]

What is being confusing to me is that I could able to decrypt the token while running my application locally, but this error occur while running the application on a Docker container, deployed on AWS.

Did you guys imagine what could be the problem? Anyone already had a situation like this?

Thanks in advance and, by the way, great library!

Best regards,

Paulo Salgado

Comments (4)

  1. Connect2id OSS

    The MAC check is there to ensure the token integrity. If bits of it get modified, for some reason, the check will fail.

    What alg + enc do you have?

  2. Paulo Salgado reporter

    Thanks for the quick feedback!

    I’m using JWEAlgorithm.DIR and EncryptionMethod.A128CBC_HS256.

    I also tried A256GCM but got a similar error.

  3. Log in to comment