|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.nimbusds.jose.crypto.DirectEncrypter
public class DirectEncrypter
Direct encrypter of JWE objects
with a
shared symmetric key. This class is thread-safe.
Supports the following JWE algorithms:
Supports the following encryption methods:
EncryptionMethod.A128CBC_HS256
EncryptionMethod.A256CBC_HS512
EncryptionMethod.A128GCM
EncryptionMethod.A256GCM
Field Summary | |
---|---|
protected SecretKey |
cmk
The content master key (CMK). |
static Set<JWEAlgorithm> |
SUPPORTED_ALGORITHMS
The supported JWE algorithms. |
static Set<EncryptionMethod> |
SUPPORTED_ENCRYPTION_METHODS
The supported encryption methods. |
Constructor Summary | |
---|---|
DirectEncrypter(byte[] key)
Creates a new direct encrypter. |
Method Summary | |
---|---|
JWECryptoParts |
encrypt(ReadOnlyJWEHeader readOnlyJWEHeader,
byte[] bytes)
Encrypts the specified clear text of a JWE object . |
byte[] |
getKey()
Gets the shared symmetric key. |
Set<JWEAlgorithm> |
supportedAlgorithms()
Returns the names of the supported JWE algorithms. |
Set<EncryptionMethod> |
supportedEncryptionMethods()
Returns the names of the supported encryption methods. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.nimbusds.jose.JWEAlgorithmProvider |
---|
supportedAlgorithms, supportedEncryptionMethods |
Field Detail |
---|
public static final Set<JWEAlgorithm> SUPPORTED_ALGORITHMS
public static final Set<EncryptionMethod> SUPPORTED_ENCRYPTION_METHODS
protected final SecretKey cmk
Constructor Detail |
---|
public DirectEncrypter(byte[] key) throws JOSEException
key
- The shared symmetric key. Must be 128 bits (16 bytes),
256 bits (32 bytes) or 512 bits (64 bytes) long. Must not
be null
.
JOSEException
- If the key length is unexpected or the
underlying secure random generator couldn't be
instantiated.Method Detail |
---|
public JWECryptoParts encrypt(ReadOnlyJWEHeader readOnlyJWEHeader, byte[] bytes) throws JOSEException
JWEEncrypter
JWE object
.
encrypt
in interface JWEEncrypter
readOnlyJWEHeader
- The JSON Web Encryption (JWE) header. Must specify a
supported JWE algorithm and must not be
null
.bytes
- The clear text to encrypt. Must not be null
.
JOSEException
- If the JWE algorithm is not supported or if
encryption failed for some other reason.public byte[] getKey()
public Set<JWEAlgorithm> supportedAlgorithms()
JWEAlgorithmProvider
alg
JWE header parameter.
supportedAlgorithms
in interface JWEAlgorithmProvider
public Set<EncryptionMethod> supportedEncryptionMethods()
JWEAlgorithmProvider
enc
JWE header parameter.
supportedEncryptionMethods
in interface JWEAlgorithmProvider
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |