public class JWEEncrypter extends Object
Supports the following JWE algorithms:
org.picketlink.json.JsonConstants.JWE.RSA1_5
org.picketlink.json.JsonConstants.JWE.RSA_OAEP
org.picketlink.json.JsonConstants.JWE.RSA_OAEP_256
Supports the following encryption algorithms:
org.picketlink.json.JsonConstants.JWE.A128CBC_HS256
org.picketlink.json.JsonConstants.JWE.A192CBC_HS384
org.picketlink.json.JsonConstants.JWE.A256CBC_HS512
org.picketlink.json.JsonConstants.JWE.A128GCM
org.picketlink.json.JsonConstants.JWE.A192GCM
org.picketlink.json.JsonConstants.JWE.A256GCM
org.picketlink.json.JsonConstants.JWE.A128CBC_HS256_DEPRECATED
org.picketlink.json.JsonConstants.JWE.A256CBC_HS512_DEPRECATED
Constructor and Description |
---|
JWEEncrypter(RSAPublicKey publicKey)
Creates a new JWE encrypter.
|
Modifier and Type | Method and Description |
---|---|
String |
encrypt(JWE jweHeader,
byte[] bytes)
Creates a JWE compact serialization.This string is BASE64URL(UTF8(JWE Protected Header)) || '.' || BASE64URL(JWEEncrypted
Key) || '.' || BASE64URL(JWE Initialization Vector) || '.' || BASE64URL(JWE Ciphertext) || '.' ||
BASE64URL(JWEAuthentication Tag).
|
RSAPublicKey |
getPublicKey()
Gets the public RSA key.
|
public JWEEncrypter(RSAPublicKey publicKey)
publicKey
- The public RSA key. Must not be null
.RuntimeException
- If the underlying secure random generator couldn't be instantiated.public RSAPublicKey getPublicKey()
public String encrypt(JWE jweHeader, byte[] bytes)
jweHeader
- The JWE Header. Must not be null
.bytes
- The byte array of message to be encrypted. Must not be null
.RuntimeException
- If any of the algorithm is unsupported.Copyright © 2019. All rights reserved.