public class X5TS256Header extends Object implements UnprotectedHeader
The x5t#S256 (X.509 certificate SHA-256 thumbprint) is a header defined in RFC 7515. It is a base64url-encoded SHA-256 thumbprint of the DER encoding of the X.509 certificate [RFC5280] corresponding to the key used to digitally sign the JWS.
The syntax of the header is:
"x5t#S256": {"type": "string"}
X5THeader
,
X5TOHeader
Modifier and Type | Field and Description |
---|---|
static String |
KEY
The json key of the protected header
|
protected String |
thumbprint
The base 64 url encoded thumbprint
|
Constructor and Description |
---|
X5TS256Header(String thumbprint)
Creates the header with provided thumbprint.
|
X5TS256Header(iaik.x509.X509Certificate certificate)
Computes the sha256 digest of the provided X509Certificate and base 64 url encodes the resulting
octets.
|
Modifier and Type | Method and Description |
---|---|
String |
getJsonKey()
Returns the json key of the x5t#S256 header.
|
protected MessageDigest |
getMessageDigest()
Returns the message digest instance of this class (SHA-256)
|
String |
getThumbprint()
Returns the incorporated thumbprint.
|
void |
writeToJson(com.fasterxml.jackson.core.JsonGenerator jsonGenerator)
Writes the Json representation of the x5t#S256 header to the provided JsonGenerator.
|
public static final String KEY
protected final String thumbprint
public X5TS256Header(String thumbprint)
Creates the header with provided thumbprint. The implementation will not check if the thumbprint is correct or correctly encoded.
thumbprint
- a base 64 url encoded thumbprintpublic X5TS256Header(iaik.x509.X509Certificate certificate) throws JWSException
Computes the sha256 digest of the provided X509Certificate and base 64 url encodes the resulting octets. Will not check whether the certificate is in fact the signer's certificate.
certificate
- the signer's certificateJWSException
- if it is not possible to encode the certificatepublic String getThumbprint()
Returns the incorporated thumbprint.
public void writeToJson(com.fasterxml.jackson.core.JsonGenerator jsonGenerator) throws IOException
Writes the Json representation of the x5t#S256 header to the provided JsonGenerator.
writeToJson
in interface ProtectedHeader
jsonGenerator
- a JsonGenerator for serializingIOException
- if it is not possible to write to the provided sourcepublic String getJsonKey()
getJsonKey
in interface JWSHeader
"x5t#S256"
protected MessageDigest getMessageDigest()
Returns the message digest instance of this class (SHA-256)
Copyright © 2022 Stiftung SIC. All rights reserved.