How do I verify tokens generated using jose4j library? #81
Replies: 1 comment
-
I would appreciate more effort in your question, e.g. format properly and an actual JWE token to test my assumption with. Or even opening the documentation and seeing there's a JWE module with a decrypt method listed? const key = jose.JWK.asKey(Buffer.from('3db71fa3dd384ecd'), { alg: 'A128KW' }) // assumes default charset is utf-8 in your system since that's what `salt.getBytes()` uses
const payload = jose.JWE.decrypt(serializedJwe, key, { algorithms: ['A128KW'] }) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Here is my code in Java end that generates the token. I need to verify this token from NodeJS
String salt = "3db71fa3dd384ecd"; Key key = new AesKey(salt.getBytes()); JsonWebEncryption jwe = new JsonWebEncryption(); jwe.setPayload(password); jwe.setAlgorithmHeaderValue(KeyManagementAlgorithmIdentifiers.A128KW); jwe.setEncryptionMethodHeaderParameter(ContentEncryptionAlgorithmIdentifiers.AES_128_CBC_HMAC_SHA_256); jwe.setKey(key); String serializedJwe = jwe.getCompactSerialization(); System.out.println(serializedJwe);
Beta Was this translation helpful? Give feedback.
All reactions