|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nimbusds.jose.crypto.RSAEncrypter
public class RSAEncrypter
This class is not fully tested and is provided for documentation and development purposes only. See Issue #11 RSA encrypter.
Field Summary | |
---|---|
static java.util.Set<JWEAlgorithm> |
SUPPORTED_ALGORITHMS
|
static java.util.Set<EncryptionMethod> |
SUPPORTED_ENCRYPTION_METHODS
|
Constructor Summary | |
---|---|
RSAEncrypter(java.security.interfaces.RSAPublicKey pubKey)
Creates a new RSA encrypter. |
Method Summary | |
---|---|
protected byte[] |
aesgcmDecrypt(javax.crypto.spec.IvParameterSpec ivParamSpec,
javax.crypto.SecretKey secretKey,
byte[] cipherText)
|
protected byte[] |
aesgcmEncrypt(javax.crypto.spec.IvParameterSpec ivParamSpec,
javax.crypto.SecretKey secretKey,
byte[] cipherText)
|
JWECryptoParts |
encrypt(ReadOnlyJWEHeader readOnlyJWEHeader,
byte[] bytes)
Encrypts the specified clear text of a JWE object . |
protected static javax.crypto.SecretKey |
generateAESCMK(int keyLength)
Generates an AES Content Master Key (CMK) of the specified length. |
protected byte[] |
generateAESGCMIV()
Generates a random 96 bit (12 byte) Initialisation Vector(IV) for use in AES-GCM encryption. |
protected int |
keyLengthForMethod(EncryptionMethod method)
Gets the Content Master Key (CMK) length for the specified encryption method. |
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. |
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 java.util.Set<JWEAlgorithm> SUPPORTED_ALGORITHMS
public static final java.util.Set<EncryptionMethod> SUPPORTED_ENCRYPTION_METHODS
Constructor Detail |
---|
public RSAEncrypter(java.security.interfaces.RSAPublicKey pubKey)
pubKey
- The public RSA key. Must not be null
.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.protected static javax.crypto.SecretKey generateAESCMK(int keyLength) throws java.security.NoSuchAlgorithmException
keyLength
- The key length, in bits.
java.security.NoSuchAlgorithmException
- If AES key generation is not
supported.protected byte[] generateAESGCMIV()
See http://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-08#section-4.9
public java.util.Set<JWEAlgorithm> supportedAlgorithms()
JWEAlgorithmProvider
alg
JWE header parameter.
supportedAlgorithms
in interface JWEAlgorithmProvider
public java.util.Set<EncryptionMethod> supportedEncryptionMethods()
JWEAlgorithmProvider
enc
JWE header parameter.
supportedEncryptionMethods
in interface JWEAlgorithmProvider
protected int keyLengthForMethod(EncryptionMethod method)
method
- The encryption method. Must be supported by this RSA
provider. Must not be null
.
protected byte[] aesgcmDecrypt(javax.crypto.spec.IvParameterSpec ivParamSpec, javax.crypto.SecretKey secretKey, byte[] cipherText) throws JOSEException
JOSEException
protected byte[] aesgcmEncrypt(javax.crypto.spec.IvParameterSpec ivParamSpec, javax.crypto.SecretKey secretKey, byte[] cipherText) throws JOSEException
JOSEException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |