Class JWS
java.lang.Object
eu.europa.esig.dss.jades.validation.JWS
- All Implemented Interfaces:
Serializable
Extension of a JSON web Signature according to RFC 7515
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.jose4j.base64url.Base64Urlstatic final shortprotected booleanprotected org.jose4j.jwx.Headersprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidcheckNotEmptyPart(String arg0, String arg1) static org.jose4j.jwx.JsonWebStructureorg.jose4j.jws.JsonWebSignatureAlgorithmprotected org.jose4j.jwa.AlgorithmConstraintsorg.jose4j.jws.JsonWebSignatureAlgorithmDeprecated.org.jose4j.jwx.Headersprotected byte[]org.jose4j.jwk.PublicJsonWebKeyGets theJWSJsonSerializationObjecteu.europa.esig.dss.enumerations.JWSSerializationTypeGets the signature's serialization type (compact, flattened, etc.)getKey()org.jose4j.keys.KeyPersuasiongetObjectHeader(String arg0) byte[]List<?> Returns a protected header value with thekeyMap<?, ?> Returns a protected header value with thekeyReturns a protected header value with thekeyReturns a protected header value with thekeyprotected org.jose4j.jca.ProviderContextprotected byte[]byte[]Returns SignatureValue bytesReturns payload string based on a 'b64' value in the protected header (The actual signed payload value)Gets unprotected header mapbyte[]booleanbooleanChecks if the signature's payload is 'b64' unencoded (see RFC 7797)protected booleanprotected voidonNewKey()org.jose4j.jwa.CryptoPrimitivevoidsetAlgorithmConstraints(org.jose4j.jwa.AlgorithmConstraints arg0) voidvoidvoidprotected voidsetCompactSerializationParts(String[] arg0) voidvoidsetCriticalHeaderNames(String... arg0) voidsetDoKeyValidation(boolean arg0) protected voidsetEncodedHeader(String arg0) voidsetEncodedPayload(String arg0) voidvoidprotected voidsetIntegrity(byte[] arg0) voidsetJwkHeader(org.jose4j.jwk.PublicJsonWebKey arg0) voidsetJwsJsonSerializationObject(JWSJsonSerializationObject jwsJsonSerializationObject) Sets theJWSJsonSerializationObjectvoidvoidsetKeyIdHeaderValue(String arg0) voidsetKnownCriticalHeaders(String... arg0) voidsetKnownCriticalHeaders(Collection<String> knownCriticalHeaders) Sets values of the 'crit' header that must be known and proceededvoidsetPayload(String arg0) voidsetPayloadBytes(byte[] arg0) voidsetPayloadCharEncoding(String arg0) voidsetPayloadOctets(byte[] payload) Sets payload binaries depending on the 'b64' header's valuevoidsetProtected(String protectedBase64Url) Sets the protected headervoidsetProviderContext(org.jose4j.jca.ProviderContext arg0) voidsetSignature(byte[] signature) voidsetUnprotected(Map<String, Object> unprotected) Sets the unprotected headervoidvoidvoidvoidvoidsign()toString()boolean
-
Field Details
-
COMPACT_SERIALIZATION_PARTS
public static final short COMPACT_SERIALIZATION_PARTS- See Also:
-
base64url
protected org.jose4j.base64url.Base64Url base64url -
headers
protected org.jose4j.jwx.Headers headers -
doKeyValidation
protected boolean doKeyValidation -
rawCompactSerialization
-
-
Constructor Details
-
JWS
public JWS()The default constructor creating an empty JsonWebSignature -
JWS
The constructor to instantiate a JWSCompactSerialization objects (RFC 7515)- Parameters:
parts- an array of String with the header, optional payload and the signature
-
-
Method Details
-
getEncodedHeader
-
setPayloadOctets
public void setPayloadOctets(byte[] payload) Sets payload binaries depending on the 'b64' header's value- Parameters:
payload- a byte array representing a payload (unencoded or encoded)
-
getSignedPayload
-
isRfc7797UnencodedPayload
public boolean isRfc7797UnencodedPayload()Checks if the signature's payload is 'b64' unencoded (see RFC 7797)- Returns:
- TRUE if 'b64' is present and set to false, FALSE otherwise
-
getSignatureValue
public byte[] getSignatureValue()Returns SignatureValue bytes- Returns:
- byte array representing a signature value
-
setSignature
public void setSignature(byte[] signature) -
setProtected
-
getUnprotected
-
setUnprotected
-
getJwsJsonSerializationObject
Gets theJWSJsonSerializationObject- Returns:
JWSJsonSerializationObject
-
setJwsJsonSerializationObject
Sets theJWSJsonSerializationObject- Parameters:
jwsJsonSerializationObject-JWSJsonSerializationObject
-
getJwsSerializationType
public eu.europa.esig.dss.enumerations.JWSSerializationType getJwsSerializationType()Gets the signature's serialization type (compact, flattened, etc.)- Returns:
JWSSerializationType
-
setKnownCriticalHeaders
Sets values of the 'crit' header that must be known and proceeded- Parameters:
knownCriticalHeaders- a collection of supportedStringheaders
-
checkCrit
protected void checkCrit() throws org.jose4j.lang.JoseException- Throws:
org.jose4j.lang.JoseException
-
getProtectedHeaderValueAsString
-
getProtectedHeaderValueAsNumber
-
getProtectedHeaderValueAsMap
-
getProtectedHeaderValueAsList
-
setPayload
-
getPayloadBytes
public byte[] getPayloadBytes() throws org.jose4j.lang.JoseException- Throws:
org.jose4j.lang.JoseException
-
getUnverifiedPayloadBytes
public byte[] getUnverifiedPayloadBytes() -
setPayloadBytes
public void setPayloadBytes(byte[] arg0) -
setCompactSerializationParts
- Throws:
org.jose4j.lang.JoseException
-
getCompactSerialization
- Throws:
org.jose4j.lang.JoseException
-
getDetachedContentCompactSerialization
- Throws:
org.jose4j.lang.JoseException
-
prepareSigningPrimitive
public org.jose4j.jwa.CryptoPrimitive prepareSigningPrimitive() throws org.jose4j.lang.JoseException- Throws:
org.jose4j.lang.JoseException
-
sign
public void sign() throws org.jose4j.lang.JoseException- Throws:
org.jose4j.lang.JoseException
-
onNewKey
protected void onNewKey() -
verifySignature
public boolean verifySignature() throws org.jose4j.lang.JoseException- Throws:
org.jose4j.lang.JoseException
-
isSupportedCriticalHeader
-
getAlgorithm
public org.jose4j.jws.JsonWebSignatureAlgorithm getAlgorithm() throws org.jose4j.lang.InvalidAlgorithmException- Throws:
org.jose4j.lang.InvalidAlgorithmException
-
getAlgorithmNoConstraintCheck
public org.jose4j.jws.JsonWebSignatureAlgorithm getAlgorithmNoConstraintCheck() throws org.jose4j.lang.InvalidAlgorithmException- Throws:
org.jose4j.lang.InvalidAlgorithmException
-
getPayload
- Throws:
org.jose4j.lang.JoseException
-
getUnverifiedPayload
-
getPayloadCharEncoding
-
setPayloadCharEncoding
-
getKeyType
- Throws:
org.jose4j.lang.InvalidAlgorithmException
-
getKeyPersuasion
public org.jose4j.keys.KeyPersuasion getKeyPersuasion() throws org.jose4j.lang.InvalidAlgorithmException- Throws:
org.jose4j.lang.InvalidAlgorithmException
-
setEncodedPayload
-
getEncodedPayload
-
getEncodedSignature
-
getSignature
protected byte[] getSignature() -
fromCompactSerialization
public static org.jose4j.jwx.JsonWebStructure fromCompactSerialization(String arg0) throws org.jose4j.lang.JoseException - Throws:
org.jose4j.lang.JoseException
-
setCompactSerialization
- Throws:
org.jose4j.lang.JoseException
-
getHeader
Deprecated. -
setHeader
-
setEncodedHeader
- Throws:
org.jose4j.lang.JoseException
-
getHeaders
public org.jose4j.jwx.Headers getHeaders() -
checkNotEmptyPart
-
getHeader
-
setHeader
-
getObjectHeader
-
setAlgorithmHeaderValue
-
getAlgorithmHeaderValue
-
setContentTypeHeaderValue
-
getContentTypeHeaderValue
-
setKeyIdHeaderValue
-
getKeyIdHeaderValue
-
getJwkHeader
public org.jose4j.jwk.PublicJsonWebKey getJwkHeader() throws org.jose4j.lang.JoseException- Throws:
org.jose4j.lang.JoseException
-
setJwkHeader
public void setJwkHeader(org.jose4j.jwk.PublicJsonWebKey arg0) -
getLeafCertificateHeaderValue
- Throws:
org.jose4j.lang.JoseException
-
getCertificateChainHeaderValue
- Throws:
org.jose4j.lang.JoseException
-
setCertificateChainHeaderValue
-
getX509CertSha1ThumbprintHeaderValue
-
setX509CertSha1ThumbprintHeaderValue
-
setX509CertSha1ThumbprintHeaderValue
-
getX509CertSha256ThumbprintHeaderValue
-
setX509CertSha256ThumbprintHeaderValue
-
setX509CertSha256ThumbprintHeaderValue
-
getKey
-
setKey
-
getIntegrity
protected byte[] getIntegrity() -
setIntegrity
protected void setIntegrity(byte[] arg0) -
isDoKeyValidation
public boolean isDoKeyValidation() -
setDoKeyValidation
public void setDoKeyValidation(boolean arg0) -
getAlgorithmConstraints
protected org.jose4j.jwa.AlgorithmConstraints getAlgorithmConstraints() -
setAlgorithmConstraints
public void setAlgorithmConstraints(org.jose4j.jwa.AlgorithmConstraints arg0) -
setCriticalHeaderNames
-
setKnownCriticalHeaders
-
getProviderCtx
protected org.jose4j.jca.ProviderContext getProviderCtx() -
setProviderContext
public void setProviderContext(org.jose4j.jca.ProviderContext arg0) -
toString
-