public abstract class JsonWebStructure extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Base64Url |
base64url |
protected boolean |
doKeyValidation |
protected Headers |
headers |
protected String |
rawCompactSerialization |
| Constructor and Description |
|---|
JsonWebStructure() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkCrit() |
protected void |
checkNotEmptyPart(String encodedPart,
String partName) |
static JsonWebStructure |
fromCompactSerialization(String cs) |
abstract Algorithm |
getAlgorithm() |
protected AlgorithmConstraints |
getAlgorithmConstraints() |
String |
getAlgorithmHeaderValue() |
abstract Algorithm |
getAlgorithmNoConstraintCheck() |
List<X509Certificate> |
getCertificateChainHeaderValue() |
abstract String |
getCompactSerialization() |
String |
getContentTypeHeaderValue() |
protected String |
getEncodedHeader() |
String |
getHeader()
Deprecated.
replaced by
getHeaders() and Headers.getFullHeaderAsJsonString() |
String |
getHeader(String name) |
Headers |
getHeaders() |
protected byte[] |
getIntegrity() |
PublicJsonWebKey |
getJwkHeader()
Gets the "jwk" (JSON Web Key) Header Parameter per
https://tools.ietf.org/html/rfc7515#section-4.1.3 and/or
https://tools.ietf.org/html/rfc7516#section-4.1.5
|
Key |
getKey() |
String |
getKeyIdHeaderValue() |
X509Certificate |
getLeafCertificateHeaderValue() |
Object |
getObjectHeader(String name) |
abstract String |
getPayload() |
protected ProviderContext |
getProviderCtx() |
String |
getX509CertSha1ThumbprintHeaderValue() |
String |
getX509CertSha256ThumbprintHeaderValue() |
boolean |
isDoKeyValidation() |
protected boolean |
isSupportedCriticalHeader(String headerName) |
protected void |
onNewKey() |
void |
setAlgorithmConstraints(AlgorithmConstraints algorithmConstraints) |
void |
setAlgorithmHeaderValue(String alg) |
void |
setCertificateChainHeaderValue(X509Certificate... chain) |
void |
setCompactSerialization(String compactSerialization) |
protected abstract void |
setCompactSerializationParts(String[] parts) |
void |
setContentTypeHeaderValue(String cty) |
void |
setCriticalHeaderNames(String... headerNames)
Sets the value(s) of the critical ("crit") header, defined in
section 4.1.11 of RFC 7515,
which indicates that those headers MUST be understood and processed by the recipient.
|
void |
setDoKeyValidation(boolean doKeyValidation) |
protected void |
setEncodedHeader(String encodedHeader) |
void |
setHeader(String name,
Object value) |
void |
setHeader(String name,
String value) |
protected void |
setIntegrity(byte[] integrity) |
void |
setJwkHeader(PublicJsonWebKey jwk)
Sets the "jwk" (JSON Web Key) Header Parameter per
https://tools.ietf.org/html/rfc7515#section-4.1.3 and/or
https://tools.ietf.org/html/rfc7516#section-4.1.5
|
void |
setKey(Key key) |
void |
setKeyIdHeaderValue(String kid) |
void |
setKnownCriticalHeaders(String... knownCriticalHeaders)
Sets the values of the critical ("crit") header that are acceptable for the library to process.
|
abstract void |
setPayload(String payload) |
void |
setProviderContext(ProviderContext providerCtx)
Sets the
ProviderContext for this JWS or JWE, which allows for
a particular Java Cryptography Architecture provider to be indicated by name to be used
for various cryptographic operations. |
void |
setX509CertSha1ThumbprintHeaderValue(String x5t) |
void |
setX509CertSha1ThumbprintHeaderValue(X509Certificate certificate) |
void |
setX509CertSha256ThumbprintHeaderValue(String x5tS256) |
void |
setX509CertSha256ThumbprintHeaderValue(X509Certificate certificate) |
String |
toString() |
protected Base64Url base64url
protected Headers headers
protected boolean doKeyValidation
protected String rawCompactSerialization
public abstract String getCompactSerialization() throws JoseException
JoseExceptionprotected abstract void setCompactSerializationParts(String[] parts) throws JoseException
JoseExceptionpublic abstract String getPayload() throws JoseException
JoseExceptionpublic abstract void setPayload(String payload)
public abstract Algorithm getAlgorithm() throws InvalidAlgorithmException
InvalidAlgorithmExceptionpublic abstract Algorithm getAlgorithmNoConstraintCheck() throws InvalidAlgorithmException
InvalidAlgorithmExceptionpublic static JsonWebStructure fromCompactSerialization(String cs) throws JoseException
JoseExceptionpublic void setCompactSerialization(String compactSerialization) throws JoseException
JoseExceptionpublic String getHeader()
protected String getEncodedHeader()
protected void setEncodedHeader(String encodedHeader) throws JoseException
JoseExceptionpublic Headers getHeaders()
protected void checkNotEmptyPart(String encodedPart, String partName) throws JoseException
JoseExceptionpublic void setAlgorithmHeaderValue(String alg)
public String getAlgorithmHeaderValue()
public void setContentTypeHeaderValue(String cty)
public String getContentTypeHeaderValue()
public void setKeyIdHeaderValue(String kid)
public String getKeyIdHeaderValue()
public PublicJsonWebKey getJwkHeader() throws JoseException
JoseException - if something goes wrong processing the "jwk" header content into a PublicJsonWebKeypublic void setJwkHeader(PublicJsonWebKey jwk)
jwk - the PublicJsonWebKey representation of the JWK that will be set as the "jwk" headerpublic X509Certificate getLeafCertificateHeaderValue() throws JoseException
JoseExceptionpublic List<X509Certificate> getCertificateChainHeaderValue() throws JoseException
JoseExceptionpublic void setCertificateChainHeaderValue(X509Certificate... chain)
public String getX509CertSha1ThumbprintHeaderValue()
public void setX509CertSha1ThumbprintHeaderValue(String x5t)
public void setX509CertSha1ThumbprintHeaderValue(X509Certificate certificate)
public String getX509CertSha256ThumbprintHeaderValue()
public void setX509CertSha256ThumbprintHeaderValue(String x5tS256)
public void setX509CertSha256ThumbprintHeaderValue(X509Certificate certificate)
public Key getKey()
public void setKey(Key key)
protected void onNewKey()
protected byte[] getIntegrity()
protected void setIntegrity(byte[] integrity)
public boolean isDoKeyValidation()
public void setDoKeyValidation(boolean doKeyValidation)
protected AlgorithmConstraints getAlgorithmConstraints()
public void setAlgorithmConstraints(AlgorithmConstraints algorithmConstraints)
public void setCriticalHeaderNames(String... headerNames)
headerNames - the name(s) of headers that will be marked as criticalpublic void setKnownCriticalHeaders(String... knownCriticalHeaders)
knownCriticalHeaders - one or more header names that will be allowed as values of the critical headerprotected void checkCrit()
throws JoseException
JoseExceptionprotected boolean isSupportedCriticalHeader(String headerName)
protected ProviderContext getProviderCtx()
public void setProviderContext(ProviderContext providerCtx)
ProviderContext for this JWS or JWE, which allows for
a particular Java Cryptography Architecture provider to be indicated by name to be used
for various cryptographic operations. A SecureRandom source of randomness can also be
supplied.providerCtx - the ProviderContext object indicating the Java Cryptography Architecture provider
to be used for various cryptographic operations.Copyright © 2021. All rights reserved.