Package com.nimbusds.jose.crypto.impl
Class RSA_OAEP
java.lang.Object
com.nimbusds.jose.crypto.impl.RSA_OAEP
RSAES OAEP methods for Content Encryption Key (CEK) encryption and
decryption. Uses the BouncyCastle.org provider. This class is thread-safe
- Version:
- 2017-11-27
- Author:
- Vladimir Dzhuvinov
-
Method Summary
Modifier and TypeMethodDescriptionstatic SecretKey
decryptCEK
(PrivateKey priv, byte[] encryptedCEK, Provider provider) Decrypts the specified encrypted Content Encryption Key (CEK).static byte[]
encryptCEK
(RSAPublicKey pub, SecretKey cek, Provider provider) Encrypts the specified Content Encryption Key (CEK).
-
Method Details
-
encryptCEK
public static byte[] encryptCEK(RSAPublicKey pub, SecretKey cek, Provider provider) throws JOSEException Encrypts the specified Content Encryption Key (CEK).- Parameters:
pub
- The public RSA key. Must not benull
.cek
- The Content Encryption Key (CEK) to encrypt. Must not benull
.provider
- The JCA provider,null
to use the default.- Returns:
- The encrypted Content Encryption Key (CEK).
- Throws:
JOSEException
- If encryption failed.
-
decryptCEK
public static SecretKey decryptCEK(PrivateKey priv, byte[] encryptedCEK, Provider provider) throws JOSEException Decrypts the specified encrypted Content Encryption Key (CEK).- Parameters:
priv
- The private RSA key. Must not benull
.encryptedCEK
- The encrypted Content Encryption Key (CEK) to decrypt. Must not benull
.provider
- The JCA provider,null
to use the default.- Returns:
- The decrypted Content Encryption Key (CEK).
- Throws:
JOSEException
- If decryption failed.
-