Package org.jose4j.jwx
Class JsonWebStructure
java.lang.Object
org.jose4j.jwx.JsonWebStructure
- Direct Known Subclasses:
JsonWebEncryption
,JsonWebSignature
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
checkNotEmptyPart
(String encodedPart, String partName) static JsonWebStructure
abstract Algorithm
protected AlgorithmConstraints
abstract Algorithm
abstract String
protected String
Deprecated.protected byte[]
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.5getKey()
getObjectHeader
(String name) abstract String
protected ProviderContext
boolean
protected boolean
isSupportedCriticalHeader
(String headerName) protected void
onNewKey()
void
setAlgorithmConstraints
(AlgorithmConstraints algorithmConstraints) void
void
void
setCompactSerialization
(String compactSerialization) protected abstract void
setCompactSerializationParts
(String[] parts) void
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
void
protected void
setIntegrity
(byte[] integrity) void
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.5void
void
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 theProviderContext
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
void
setX509CertSha1ThumbprintHeaderValue
(X509Certificate certificate) void
void
setX509CertSha256ThumbprintHeaderValue
(X509Certificate certificate) toString()
-
Field Details
-
base64url
-
headers
-
doKeyValidation
protected boolean doKeyValidation -
rawCompactSerialization
-
-
Constructor Details
-
JsonWebStructure
public JsonWebStructure()
-
-
Method Details
-
getCompactSerialization
- Throws:
JoseException
-
setCompactSerializationParts
- Throws:
JoseException
-
getPayload
- Throws:
JoseException
-
setPayload
-
getAlgorithm
- Throws:
InvalidAlgorithmException
-
getAlgorithmNoConstraintCheck
- Throws:
InvalidAlgorithmException
-
fromCompactSerialization
- Throws:
JoseException
-
setCompactSerialization
- Throws:
JoseException
-
getHeader
Deprecated.replaced bygetHeaders()
andHeaders.getFullHeaderAsJsonString()
- Returns:
- the header as JSON
-
getEncodedHeader
-
setHeader
-
setEncodedHeader
- Throws:
JoseException
-
getHeaders
-
checkNotEmptyPart
- Throws:
JoseException
-
getHeader
-
setHeader
-
getObjectHeader
-
setAlgorithmHeaderValue
-
getAlgorithmHeaderValue
-
setContentTypeHeaderValue
-
getContentTypeHeaderValue
-
setKeyIdHeaderValue
-
getKeyIdHeaderValue
-
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- Returns:
- PublicJsonWebKey representation of the "jwk" header
- Throws:
JoseException
- if something goes wrong processing the "jwk" header content into a PublicJsonWebKey
-
setJwkHeader
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- Parameters:
jwk
- the PublicJsonWebKey representation of the JWK that will be set as the "jwk" header
-
getLeafCertificateHeaderValue
- Throws:
JoseException
-
getCertificateChainHeaderValue
- Throws:
JoseException
-
setCertificateChainHeaderValue
-
getX509CertSha1ThumbprintHeaderValue
-
setX509CertSha1ThumbprintHeaderValue
-
setX509CertSha1ThumbprintHeaderValue
-
getX509CertSha256ThumbprintHeaderValue
-
setX509CertSha256ThumbprintHeaderValue
-
setX509CertSha256ThumbprintHeaderValue
-
getKey
-
setKey
-
onNewKey
protected void onNewKey() -
getIntegrity
protected byte[] getIntegrity() -
setIntegrity
protected void setIntegrity(byte[] integrity) -
isDoKeyValidation
public boolean isDoKeyValidation() -
setDoKeyValidation
public void setDoKeyValidation(boolean doKeyValidation) -
getAlgorithmConstraints
-
setAlgorithmConstraints
-
setCriticalHeaderNames
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.- Parameters:
headerNames
- the name(s) of headers that will be marked as critical
-
setKnownCriticalHeaders
Sets the values of the critical ("crit") header that are acceptable for the library to process. Basically calling this is telling the jose4j library to allow these headers marked as critical and saying that the caller knows how to process them and will do so.- Parameters:
knownCriticalHeaders
- one or more header names that will be allowed as values of the critical header
-
checkCrit
- Throws:
JoseException
-
isSupportedCriticalHeader
-
getProviderCtx
-
setProviderContext
Sets theProviderContext
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. ASecureRandom
source of randomness can also be supplied.- Parameters:
providerCtx
- the ProviderContext object indicating the Java Cryptography Architecture provider to be used for various cryptographic operations.
-
toString
-
getHeaders()
andHeaders.getFullHeaderAsJsonString()