public class RSAEncrypter extends java.lang.Object implements JWEEncrypter
JWE objects. This class
is thread-safe.
Supports the following JWE algorithms:
Supports the following encryption methods:
| Modifier and Type | Field and Description |
|---|---|
static java.util.Set<JWEAlgorithm> |
SUPPORTED_ALGORITHMS
The supported JWE algorithms.
|
static java.util.Set<EncryptionMethod> |
SUPPORTED_ENCRYPTION_METHODS
The supported encryption methods.
|
| Constructor and Description |
|---|
RSAEncrypter(java.security.interfaces.RSAPublicKey publicKey)
Creates a new RSA encrypter.
|
| Modifier and Type | Method and Description |
|---|---|
protected static int |
cekBitLength(EncryptionMethod method)
Gets the Content Encryption Key (CEK) length for the specified
encryption method.
|
protected static int |
cikBitLength(EncryptionMethod method)
Gets the Content Integrity Key (CIK) length for the specified
encryption method.
|
protected static int |
cmkBitLength(EncryptionMethod method)
Gets the Content Master Key (CMK) length for the specified
encryption method.
|
JWECryptoParts |
encrypt(ReadOnlyJWEHeader readOnlyJWEHeader,
byte[] bytes)
Encrypts the specified clear text of a
JWE object. |
java.security.interfaces.RSAPublicKey |
getPublicKey()
Gets the public RSA key.
|
java.util.Set<JWEAlgorithm> |
supportedAlgorithms()
Returns the names of the supported JWE algorithms.
|
java.util.Set<EncryptionMethod> |
supportedEncryptionMethods()
Returns the names of the supported encryption methods.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsupportedAlgorithms, supportedEncryptionMethodspublic static final java.util.Set<JWEAlgorithm> SUPPORTED_ALGORITHMS
public static final java.util.Set<EncryptionMethod> SUPPORTED_ENCRYPTION_METHODS
public RSAEncrypter(java.security.interfaces.RSAPublicKey publicKey) throws JOSEException
publicKey - The public RSA key. Must not be null.JOSEException - If the underlying secure random generator
couldn't be instantiated.public java.security.interfaces.RSAPublicKey getPublicKey()
public JWECryptoParts encrypt(ReadOnlyJWEHeader readOnlyJWEHeader, byte[] bytes) throws JOSEException
JWEEncrypterJWE object.encrypt in interface JWEEncrypterreadOnlyJWEHeader - 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.protected static int cmkBitLength(EncryptionMethod method) throws JOSEException
method - The encryption method. Must be supported by this RSA
provider. Must not be null.JOSEException - If the encryption method is not supported.protected static int cekBitLength(EncryptionMethod method) throws JOSEException
method - The encryption method. Must be supported by this RSA
provider and must employ CEKs. Must not be
null.JOSEException - If the encryption method is not supported or
doesn't employ CEKs.protected static int cikBitLength(EncryptionMethod method) throws JOSEException
method - The encryption method. Must be supported by this RSA
provider and must employ CIKs. Must not be
null.JOSEException - If the encryption method is not supported or
doesn't employ CIKs.public java.util.Set<JWEAlgorithm> supportedAlgorithms()
JWEAlgorithmProvideralg JWE header parameter.supportedAlgorithms in interface JWEAlgorithmProviderpublic java.util.Set<EncryptionMethod> supportedEncryptionMethods()
JWEAlgorithmProviderenc JWE header parameter.supportedEncryptionMethods in interface JWEAlgorithmProviderCopyright © 2013 NimbusDS. All Rights Reserved.