Class AbstractRecipient

java.lang.Object
org.bouncycastle.cms.AbstractRecipient
Direct Known Subclasses:
AbstractKeyAgreeRecipient, AbstractKeyTransRecipient, BcKEKRecipient, BcKEMRecipient, BcKeyTransRecipient, BcPasswordRecipient, JceKEKRecipient, JceKEMRecipient, JceKTSKeyTransRecipient, JcePasswordRecipient

public abstract class AbstractRecipient extends Object
Base class for the CMS recipient implementations, carrying the optional restrictions on which content-encryption algorithms a recipient is willing to recover content for, and on the minimum AEAD authentication tag size it will accept.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected final void
    checkContentAlgorithm(org.bouncycastle.asn1.x509.AlgorithmIdentifier contentAlgorithm)
    Apply both of the recipient's restrictions to the content-encryption algorithm the message names, resolving an RFC 9709 key-derivation wrapper to the content-encryption algorithm it carries first, so that the restrictions are applied to the algorithm the content is actually encrypted under.
    protected final void
    checkTagSize(org.bouncycastle.asn1.x509.AlgorithmIdentifier contentAlgorithm)
    Refuse an AEAD content algorithm whose authentication tag is shorter than the configured minimum.
    protected final boolean
    isContentAlgorithmAllowed(org.bouncycastle.asn1.ASN1ObjectIdentifier contentAlgorithm)
     
    protected final void
    setAllowedContentAlgorithmSet(Set<org.bouncycastle.asn1.ASN1ObjectIdentifier> allowedContentAlgorithms)
     
    protected final void
    setMinimumTagSizeInBits(int tagSizeInBits)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractRecipient

      public AbstractRecipient()
  • Method Details

    • setAllowedContentAlgorithmSet

      protected final void setAllowedContentAlgorithmSet(Set<org.bouncycastle.asn1.ASN1ObjectIdentifier> allowedContentAlgorithms)
    • isContentAlgorithmAllowed

      protected final boolean isContentAlgorithmAllowed(org.bouncycastle.asn1.ASN1ObjectIdentifier contentAlgorithm)
    • setMinimumTagSizeInBits

      protected final void setMinimumTagSizeInBits(int tagSizeInBits)
    • checkTagSize

      protected final void checkTagSize(org.bouncycastle.asn1.x509.AlgorithmIdentifier contentAlgorithm) throws CMSTagLengthException
      Refuse an AEAD content algorithm whose authentication tag is shorter than the configured minimum. A no-op when no minimum is set or when the content algorithm is not AEAD.
      Parameters:
      contentAlgorithm - the content-encryption AlgorithmIdentifier (carries the AEAD ICV length).
      Throws:
      CMSTagLengthException - if the tag size is below the configured minimum.
    • checkContentAlgorithm

      protected final void checkContentAlgorithm(org.bouncycastle.asn1.x509.AlgorithmIdentifier contentAlgorithm) throws CMSException
      Apply both of the recipient's restrictions to the content-encryption algorithm the message names, resolving an RFC 9709 key-derivation wrapper to the content-encryption algorithm it carries first, so that the restrictions are applied to the algorithm the content is actually encrypted under.
      Parameters:
      contentAlgorithm - the content-encryption AlgorithmIdentifier taken from the message.
      Throws:
      CMSAlgorithmNotAllowedException - if the content algorithm is not in the allowed set.
      CMSTagLengthException - if the tag size is below the configured minimum.
      CMSException