public class SignedJwt extends Object implements Jwt, Payload
JSON Web Signature (JWS) is a means of representing content secured with digital signatures or Message Authentication Codes (MACs) using JSON based data structures.
| Modifier | Constructor and Description |
|---|---|
|
SignedJwt(JwsHeader header,
JwtClaimsSet claimsSet,
byte[] signingInput,
byte[] signature)
Constructs a reconstructed SignedJwt from its constituent parts, the JwsHeader, JwtClaimsSet, signing input and
signature.
|
|
SignedJwt(JwsHeader header,
JwtClaimsSet claimsSet,
SigningHandler signingHandler)
Constructs a fresh, new SignedJwt from the given JwsHeader and JwtClaimsSet.
|
protected |
SignedJwt(JwsHeader header,
Payload nestedPayload,
byte[] signingInput,
byte[] signature)
Constructs a reconstructed SignedJwt from its constituent parts, the JwsHeader, nested Encrypted JWT, signing
input and signature.
|
protected |
SignedJwt(JwsHeader header,
Payload nestedPayload,
SigningHandler signingHandler)
Constructs a fresh, new SignedJwt from the given JwsHeader and nested Encrypted JWT.
|
| Modifier and Type | Method and Description |
|---|---|
String |
build()
Builds the JWT into a
String by following the steps specified in the relevant specification
according to whether the JWT is being signed and/or encrypted. |
JwtClaimsSet |
getClaimsSet()
Gets the claims set object for the Jwt, which contains all of the claims (name value pairs) conveyed by the JWT.
|
JwsHeader |
getHeader()
Gets the header object for the JWT, which contains properties which describe the cryptographic operations
applied to the JWT, among other properties.
|
protected Payload |
getPayload()
Gets the payload for the JWS, which will either be a JWT Claims Set,
getClaimsSet(), or a nested
EncryptedJwt, EncryptedJwt. |
boolean |
verify(SigningHandler signingHandler)
Verifies that the JWS signature is valid for the contents of its payload.
|
public SignedJwt(JwsHeader header, JwtClaimsSet claimsSet, SigningHandler signingHandler)
The specified private key will be used in the creation of the JWS signature.
header - The JwsHeader containing the header parameters of the JWS.claimsSet - The JwtClaimsSet containing the claims of the JWS.signingHandler - The SigningHandler instance used to sign the JWS.public SignedJwt(JwsHeader header, JwtClaimsSet claimsSet, byte[] signingInput, byte[] signature)
For use when a signed JWT has been reconstructed from its base64url encoded string representation and the signature needs verifying.
header - The JwsHeader containing the header parameters of the JWS.claimsSet - The JwsClaimsSet containing the claims of the JWS.signingInput - The original data that was signed, being the base64url encoding of the JWS header and
claims set concatenated using a "." character.signature - The resulting signature of signing the signing input.protected SignedJwt(JwsHeader header, Payload nestedPayload, SigningHandler signingHandler)
The specified private key will be used in the creation of the JWS signature.
header - The JwsHeader containing the header parameters of the JWS.nestedPayload - The nested payload that will be the payload of this JWS.signingHandler - The SigningHandler instance used to sign the JWS.protected SignedJwt(JwsHeader header, Payload nestedPayload, byte[] signingInput, byte[] signature)
For use when a signed nested encrypted JWT has been reconstructed from its base64url encoded string representation and the signature needs verifying.
header - The JwsHeader containing the header parameters of the JWS.nestedPayload - The nested payload that is the payload of the JWS.signingInput - The original data that was signed, being the base64url encoding of the JWS header and
payload concatenated using a "." character.signature - The resulting signature of signing the signing input.public JwsHeader getHeader()
When the JWT is digitally signed or MACed, the JWT Header is a JWS Header. When the JWT is encrypted, the JWT Header is a JWE Header.
public JwtClaimsSet getClaimsSet()
getClaimsSet in interface Jwtprotected Payload getPayload()
getClaimsSet(), or a nested
EncryptedJwt, EncryptedJwt.EncryptedThenSignedJwtpublic String build()
String by following the steps specified in the relevant specification
according to whether the JWT is being signed and/or encrypted.
build in interface Jwtbuild in interface Payloadpublic boolean verify(SigningHandler signingHandler)
The same private key must be given here as was used to create the signature.
signingHandler - The SigningHandler instance used to verify the JWS.true if the signature matches the JWS Header and payload.Copyright © 2025 Open Identity Platform Community. All rights reserved.