Package org.jose4j.jwe
Class JsonWebEncryption
java.lang.Object
org.jose4j.jwx.JsonWebStructure
org.jose4j.jwe.JsonWebEncryption
-
Field Summary
FieldsFields inherited from class org.jose4j.jwx.JsonWebStructure
doKeyValidation, headers, rawCompactSerialization -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbyte[]byte[]byte[]getIv()byte[]Create, initialize and return theCryptoPrimitivethat this JWE instance will use for agreement or decryption of the content encryption key.protected voidsetCompactSerializationParts(String[] parts) voidvoidsetContentEncryptionAlgorithmConstraints(AlgorithmConstraints contentEncryptionAlgorithmConstraints) voidsetContentEncryptionKey(byte[] contentEncryptionKey) voidsetEncodedContentEncryptionKey(String encodedContentEncryptionKey) voidsetEncodedIv(String encodedIv) voidvoidsetIv(byte[] iv) voidsetPayload(String payload) voidsetPlaintext(byte[] plaintext) voidsetPlaintext(String plaintext) voidsetPlainTextCharEncoding(String plaintextCharEncoding) Methods inherited from class org.jose4j.jwx.JsonWebStructure
checkCrit, checkNotEmptyPart, fromCompactSerialization, getAlgorithmConstraints, getAlgorithmHeaderValue, getCertificateChainHeaderValue, getContentTypeHeaderValue, getEncodedHeader, getHeader, getHeader, getHeaders, getIntegrity, getJwkHeader, getKey, getKeyIdHeaderValue, getLeafCertificateHeaderValue, getObjectHeader, getProviderCtx, getX509CertSha1ThumbprintHeaderValue, getX509CertSha256ThumbprintHeaderValue, isDoKeyValidation, isSupportedCriticalHeader, onNewKey, setAlgorithmConstraints, setAlgorithmHeaderValue, setCertificateChainHeaderValue, setCompactSerialization, setContentTypeHeaderValue, setCriticalHeaderNames, setDoKeyValidation, setEncodedHeader, setHeader, setHeader, setIntegrity, setJwkHeader, setKey, setKeyIdHeaderValue, setKnownCriticalHeaders, setProviderContext, setX509CertSha1ThumbprintHeaderValue, setX509CertSha1ThumbprintHeaderValue, setX509CertSha256ThumbprintHeaderValue, setX509CertSha256ThumbprintHeaderValue, toString
-
Field Details
-
COMPACT_SERIALIZATION_PARTS
public static final short COMPACT_SERIALIZATION_PARTS- See Also:
-
-
Constructor Details
-
JsonWebEncryption
public JsonWebEncryption()
-
-
Method Details
-
setPlainTextCharEncoding
-
setPlaintext
public void setPlaintext(byte[] plaintext) -
setPlaintext
-
getPlaintextString
- Throws:
JoseException
-
getPlaintextBytes
- Throws:
JoseException
-
getPayload
- Specified by:
getPayloadin classJsonWebStructure- Throws:
JoseException
-
setPayload
- Specified by:
setPayloadin classJsonWebStructure
-
setEncryptionMethodHeaderParameter
-
getEncryptionMethodHeaderParameter
-
setCompressionAlgorithmHeaderParameter
-
getCompressionAlgorithmHeaderParameter
-
enableDefaultCompression
public void enableDefaultCompression() -
setContentEncryptionAlgorithmConstraints
public void setContentEncryptionAlgorithmConstraints(AlgorithmConstraints contentEncryptionAlgorithmConstraints) -
getContentEncryptionAlgorithm
- Throws:
InvalidAlgorithmException
-
getKeyManagementModeAlgorithm
- Throws:
InvalidAlgorithmException
-
getAlgorithmNoConstraintCheck
- Specified by:
getAlgorithmNoConstraintCheckin classJsonWebStructure- Throws:
InvalidAlgorithmException
-
getAlgorithm
- Specified by:
getAlgorithmin classJsonWebStructure- Throws:
InvalidAlgorithmException
-
setCompactSerializationParts
- Specified by:
setCompactSerializationPartsin classJsonWebStructure- Throws:
JoseException
-
prepareDecryptingPrimitive
Create, initialize and return theCryptoPrimitivethat this JWE instance will use for agreement or decryption of the content encryption key. This can optionally be called after setting the key (and maybe ProviderContext) but before getting the payload (which is when the decryption magic happens). This method provides access to the underlying primitive instance (e.g. aCipher), which allows execution of the operation to be gated by some approval or authorization. For example, signing on Android with a key that was set to require user authentication when created needs a biometric prompt to allow the signature to execute with the key.- Returns:
- a CryptoPrimitive containing either a
Cipher,KeyAgreement, etc., or null - Throws:
JoseException- if an error condition is encountered during the initialization process
-
getEncryptedKey
public byte[] getEncryptedKey() -
getCompactSerialization
- Specified by:
getCompactSerializationin classJsonWebStructure- Throws:
JoseException
-
getContentEncryptionKey
public byte[] getContentEncryptionKey() -
setContentEncryptionKey
public void setContentEncryptionKey(byte[] contentEncryptionKey) -
setEncodedContentEncryptionKey
-
getIv
public byte[] getIv() -
setIv
public void setIv(byte[] iv) -
setEncodedIv
-