public class WPJWEObject
extends java.lang.Object
serialize()
which should be called after encrypt()
Constructor and Description |
---|
WPJWEObject(WPJWEHeader header,
java.lang.String payload)
Creates a JWE object based on the provided JWE header and plain payload
|
Modifier and Type | Method and Description |
---|---|
void |
encrypt()
Encrypts the the plain payload
|
java.lang.String |
serialize()
Serialises this JWE object to its compact format consisting of
Base64URL-encoded parts delimited by period ('.') characters.
|
void |
setKey(java.security.Key key)
Set the key encryption key.
|
public WPJWEObject(WPJWEHeader header, java.lang.String payload)
header
- a WPJWEHeader
instance, that must not be nullpayload
- a plain string payloadpublic void encrypt() throws WPCSEException
WPCSEException
- If encryption failed.public java.lang.String serialize() throws WPCSEException
[header-base64url].[encryptedKey-base64url].[iv-base64url].[cipherText-base64url].[authTag-base64url]
WPCSEException
public void setKey(java.security.Key key)
key
- the key (by default it should be an instance of RSAPublicKey).