Class RSA1_5

java.lang.Object
com.nimbusds.jose.crypto.impl.RSA1_5

@ThreadSafe public class RSA1_5 extends Object
RSAES-PKCS1-V1_5 methods for Content Encryption Key (CEK) encryption and decryption. This class is thread-safe.
Version:
2021-09-24
Author:
Vladimir Dzhuvinov
  • 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 be null.
      cek - The Content Encryption Key (CEK) to encrypt. Must not be null.
      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, int keyLength, Provider provider) throws JOSEException
      Decrypts the specified encrypted Content Encryption Key (CEK).
      Parameters:
      priv - The private RSA key. Must not be null.
      encryptedCEK - The encrypted Content Encryption Key (CEK) to decrypt. Must not be null.
      provider - The JCA provider, null to use the default.
      Returns:
      The decrypted Content Encryption Key (CEK), null if there was a CEK key length mismatch.
      Throws:
      JOSEException - If decryption failed.