Bouncy Castle Cryptography Library 1.87

org.bouncycastle.cms.bc
Class BcKEMRecipient

java.lang.Object
  extended byorg.bouncycastle.cms.AbstractRecipient
      extended byorg.bouncycastle.cms.bc.BcKEMRecipient
All Implemented Interfaces:
KEMRecipient, Recipient
Direct Known Subclasses:
BcKEMEnvelopedRecipient

public abstract class BcKEMRecipient
extends AbstractRecipient
implements KEMRecipient

Base class for recovering the content-encryption key from an RFC 9629 KEMRecipientInfo using the light-weight API. The recipient's key must be an ML-KEM private key.


Constructor Summary
BcKEMRecipient(org.bouncycastle.crypto.params.AsymmetricKeyParameter recipientKey)
           
 
Method Summary
protected  org.bouncycastle.crypto.CipherParameters extractSecretKey(org.bouncycastle.asn1.x509.AlgorithmIdentifier keyEncryptionAlgorithm, org.bouncycastle.asn1.x509.AlgorithmIdentifier contentEncryptionAlgorithm, byte[] encryptedContentEncryptionKey)
           
 BcKEMRecipient setAllowedContentAlgorithms(java.util.Set allowedContentAlgorithms)
          Set the content-encryption algorithms this recipient is willing to unwrap a key for.
 
Methods inherited from class org.bouncycastle.cms.AbstractRecipient
checkContentAlgorithm, checkTagSize, isContentAlgorithmAllowed, setAllowedContentAlgorithmSet, setMinimumTagSizeInBits
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.bouncycastle.cms.KEMRecipient
getRecipientOperator
 

Constructor Detail

BcKEMRecipient

public BcKEMRecipient(org.bouncycastle.crypto.params.AsymmetricKeyParameter recipientKey)
Method Detail

setAllowedContentAlgorithms

public BcKEMRecipient setAllowedContentAlgorithms(java.util.Set allowedContentAlgorithms)
Set the content-encryption algorithms this recipient is willing to unwrap a key for. When set, an attempt to recover content protected under any other algorithm is rejected, mitigating an attacker substituting a weaker content-encryption algorithm into the recipient info.

Parameters:
allowedContentAlgorithms - the set of permitted content-encryption algorithm OIDs.
Returns:
this recipient.

extractSecretKey

protected org.bouncycastle.crypto.CipherParameters extractSecretKey(org.bouncycastle.asn1.x509.AlgorithmIdentifier keyEncryptionAlgorithm,
                                                                    org.bouncycastle.asn1.x509.AlgorithmIdentifier contentEncryptionAlgorithm,
                                                                    byte[] encryptedContentEncryptionKey)
                                                             throws CMSException
Throws:
CMSException

Bouncy Castle Cryptography Library 1.87