Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error Decrypting JWE

Kind of new to the JWE Decryption thing. I have a server that performs the JWE and sent it to client based on a key that is shared between server and client.

I am using a Jose4j for decrypting and am getting this error

java.lang.NullPointerException: The plaintext payload for the JWE has not been set.

I am using the sample code as shown in this link,Receiver part

https://bitbucket.org/b_c/jose4j/wiki/JWE%20Examples

I don't have any insight into the server am just writing the client. I am confused if the paylaod itself is not coming or that framework is goofing up trying to decrypt.

Any pointers to debug the issue is appreciated

Regards, Aravind

like image 980
Aravind R Avatar asked Aug 10 '26 23:08

Aravind R


1 Answers

That particular exception is only thrown from the getCompactSerialization() method when there is no payload set - getCompactSerialization() is the last step on sending/encrypting side to create the JWE. If you are decrypting, you shouldn't be calling that. Maybe you've got an accidental call somewhere? Otherwise, the code your using as well as an example raw JWE value might help troubleshot (and keys, if it's just a test and you can share them).

like image 178
Brian Campbell Avatar answered Aug 13 '26 14:08

Brian Campbell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!