public class RSAKEMCipherSpi
extends javax.crypto.CipherSpi
"RSA-KTS-KEM-KWS" and aliased
against the id-kem-rsa object identifier (1.0.18033.2.2.4).
Driven by the CMS pipeline through
org.bouncycastle.cms.jcajce.JceKEMRecipientInfoGenerator (wrap) and
org.bouncycastle.cms.jcajce.JceKEMEnvelopedRecipient (unwrap) when the
recipient holds an RSA key; the analogous peer for ML-KEM is
MLKEMCipherSpi.
Cipher operates in WRAP_MODE / UNWRAP_MODE only and requires a
KTSParameterSpec carrying the KDF (KDF2 / KDF3 / HKDF per RFC 9690
§4) and the AES-Wrap variant. Wrap output is the RSA-KEM ciphertext
(modulus-byte length) concatenated with the AES-wrapped CEK; the CMS caller
splits them based on the modulus length.
| Constructor and Description |
|---|
RSAKEMCipherSpi() |
| Modifier and Type | Method and Description |
|---|---|
protected byte[] |
engineDoFinal(byte[] bytes,
int i,
int i1) |
protected int |
engineDoFinal(byte[] bytes,
int i,
int i1,
byte[] bytes1,
int i2) |
protected int |
engineGetBlockSize() |
protected byte[] |
engineGetIV() |
protected int |
engineGetKeySize(java.security.Key key) |
protected int |
engineGetOutputSize(int inputLen) |
protected java.security.AlgorithmParameters |
engineGetParameters() |
protected void |
engineInit(int opmode,
java.security.Key key,
java.security.spec.AlgorithmParameterSpec paramSpec,
java.security.SecureRandom random) |
protected void |
engineInit(int opmode,
java.security.Key key,
java.security.AlgorithmParameters algorithmParameters,
java.security.SecureRandom random) |
protected void |
engineInit(int opmode,
java.security.Key key,
java.security.SecureRandom random) |
protected void |
engineSetMode(java.lang.String mode) |
protected void |
engineSetPadding(java.lang.String padding) |
protected java.security.Key |
engineUnwrap(byte[] wrappedKey,
java.lang.String wrappedKeyAlgorithm,
int wrappedKeyType) |
protected byte[] |
engineUpdate(byte[] bytes,
int i,
int i1) |
protected int |
engineUpdate(byte[] bytes,
int i,
int i1,
byte[] bytes1,
int i2) |
protected byte[] |
engineWrap(java.security.Key key) |
protected void engineSetMode(java.lang.String mode)
throws java.security.NoSuchAlgorithmException
engineSetMode in class javax.crypto.CipherSpijava.security.NoSuchAlgorithmExceptionprotected void engineSetPadding(java.lang.String padding)
throws javax.crypto.NoSuchPaddingException
engineSetPadding in class javax.crypto.CipherSpijavax.crypto.NoSuchPaddingExceptionprotected int engineGetKeySize(java.security.Key key)
engineGetKeySize in class javax.crypto.CipherSpiprotected int engineGetBlockSize()
engineGetBlockSize in class javax.crypto.CipherSpiprotected int engineGetOutputSize(int inputLen)
engineGetOutputSize in class javax.crypto.CipherSpiprotected byte[] engineGetIV()
engineGetIV in class javax.crypto.CipherSpiprotected java.security.AlgorithmParameters engineGetParameters()
engineGetParameters in class javax.crypto.CipherSpiprotected void engineInit(int opmode,
java.security.Key key,
java.security.SecureRandom random)
throws java.security.InvalidKeyException
engineInit in class javax.crypto.CipherSpijava.security.InvalidKeyExceptionprotected void engineInit(int opmode,
java.security.Key key,
java.security.spec.AlgorithmParameterSpec paramSpec,
java.security.SecureRandom random)
throws java.security.InvalidKeyException,
java.security.InvalidAlgorithmParameterException
engineInit in class javax.crypto.CipherSpijava.security.InvalidKeyExceptionjava.security.InvalidAlgorithmParameterExceptionprotected void engineInit(int opmode,
java.security.Key key,
java.security.AlgorithmParameters algorithmParameters,
java.security.SecureRandom random)
throws java.security.InvalidKeyException,
java.security.InvalidAlgorithmParameterException
engineInit in class javax.crypto.CipherSpijava.security.InvalidKeyExceptionjava.security.InvalidAlgorithmParameterExceptionprotected byte[] engineUpdate(byte[] bytes,
int i,
int i1)
engineUpdate in class javax.crypto.CipherSpiprotected int engineUpdate(byte[] bytes,
int i,
int i1,
byte[] bytes1,
int i2)
throws javax.crypto.ShortBufferException
engineUpdate in class javax.crypto.CipherSpijavax.crypto.ShortBufferExceptionprotected byte[] engineDoFinal(byte[] bytes,
int i,
int i1)
throws javax.crypto.IllegalBlockSizeException,
javax.crypto.BadPaddingException
engineDoFinal in class javax.crypto.CipherSpijavax.crypto.IllegalBlockSizeExceptionjavax.crypto.BadPaddingExceptionprotected int engineDoFinal(byte[] bytes,
int i,
int i1,
byte[] bytes1,
int i2)
throws javax.crypto.ShortBufferException,
javax.crypto.IllegalBlockSizeException,
javax.crypto.BadPaddingException
engineDoFinal in class javax.crypto.CipherSpijavax.crypto.ShortBufferExceptionjavax.crypto.IllegalBlockSizeExceptionjavax.crypto.BadPaddingExceptionprotected byte[] engineWrap(java.security.Key key)
throws javax.crypto.IllegalBlockSizeException,
java.security.InvalidKeyException
engineWrap in class javax.crypto.CipherSpijavax.crypto.IllegalBlockSizeExceptionjava.security.InvalidKeyExceptionprotected java.security.Key engineUnwrap(byte[] wrappedKey,
java.lang.String wrappedKeyAlgorithm,
int wrappedKeyType)
throws java.security.InvalidKeyException,
java.security.NoSuchAlgorithmException
engineUnwrap in class javax.crypto.CipherSpijava.security.InvalidKeyExceptionjava.security.NoSuchAlgorithmException