Provide an example to decrypt jwe where KeyManagementAlgorithm is PBES2-HS256+A128KW
Issue #172
new
I need to decrypt a JWK Private key encrypted using JWE.
Content encryption key is encrypted using PBES2-HS256+A128KW algorithm where a shared passphrase is used to derive AES key which then encrypts the CEK.
Currently there is no example in the wiki for the mentioned scenario.
Need your help. Thanks
Comments (3)
-
repo owner -
Hi Brian, I’ve been looking at the examples as well, looks like it all works even without `PbkdfKey`, not sure `SecretKeySpec` cares about the algorithm :-). thanks
-
repo owner Yeah, the key derivation isn’t looking at the algorithm and all PbkdfKey really does it convert the UTF8 password sting to a byte array that will be the key.
- Log in to comment
There’s some code that should help show how that could be done in the tests at https://bitbucket.org/b_c/jose4j/src/master/src/test/java/org/jose4j/jwe/Pbes2HmacShaWithAesKeyWrapAlgorithmTest.java and https://bitbucket.org/b_c/jose4j/src/d18b8075c76b7eb50349cb58b48f997bc8e821bd/src/test/java/org/jose4j/cookbook/JoseCookbookTest.java#lines-943