Package org.jose4j.jwx
Class JsonWebStructure
java.lang.Object
org.jose4j.jwx.JsonWebStructure
- Direct Known Subclasses:
JsonWebEncryption,JsonWebSignature
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidcheckNotEmptyPart(String encodedPart, String partName) static JsonWebStructureabstract Algorithmprotected AlgorithmConstraintsabstract Algorithmabstract Stringprotected StringDeprecated.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 Stringprotected ProviderContextbooleanprotected booleanisSupportedCriticalHeader(String headerName) protected voidonNewKey()voidsetAlgorithmConstraints(AlgorithmConstraints algorithmConstraints) voidvoidvoidsetCompactSerialization(String compactSerialization) protected abstract voidsetCompactSerializationParts(String[] parts) voidvoidsetCriticalHeaderNames(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.voidsetDoKeyValidation(boolean doKeyValidation) protected voidsetEncodedHeader(String encodedHeader) voidvoidprotected voidsetIntegrity(byte[] integrity) voidSets 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.5voidvoidvoidsetKnownCriticalHeaders(String... knownCriticalHeaders) Sets the values of the critical ("crit") header that are acceptable for the library to process.abstract voidsetPayload(String payload) voidsetProviderContext(ProviderContext providerCtx) Sets theProviderContextfor 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.voidvoidsetX509CertSha1ThumbprintHeaderValue(X509Certificate certificate) voidvoidsetX509CertSha256ThumbprintHeaderValue(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 theProviderContextfor 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. ASecureRandomsource 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()