Access to encoded JWS when processing JWE?

Issue #164 resolved
Christian Brandt created an issue

Hello!

Just a quick question: Would it be possible to get access to encoded representation of JWS when processing JWEs with JwtConsumer?

In my case, the decryption and signature verification works great, there is no problem there. However, I would
like to get access to encoded representation of the JWS (from JwtContext), but can't see decent way to do that.

After processing the context actually contains two JoseObjects:

  • JsonWebSignature
  • JsonWebEncryption

The JsonWebSignature object would have what I am looking for in rawCompactSerialization field,
but it is not public and there is no accessor to it.

I believe there is a similar way in other library (com.nimbusds.jose) where you could just: jweObject.getPayload().toSignedJWT()

https://www.javadoc.io/doc/com.nimbusds/nimbus-jose-jwt/5.9/com/nimbusds/jose/Payload.html#toSignedJWT--

Comments (6)

  1. Brian Campbell repo owner

    calling getPayload() on the JsonWebEncryption object should give you exactly that. With a nested JWT that is signed and then encrypted, the plaintext payload of the JWE is the JWS.

  2. Log in to comment