Class CMSAuthenticatedData

java.lang.Object
org.bouncycastle.cms.CMSAuthenticatedData
All Implemented Interfaces:
org.bouncycastle.util.Encodable

public class CMSAuthenticatedData extends Object implements org.bouncycastle.util.Encodable
containing class for an CMS Authenticated Data object
  • Constructor Details

    • CMSAuthenticatedData

      public CMSAuthenticatedData(byte[] authData) throws CMSException
      Create a CMSAuthenticatedData object from its encoding.
      Parameters:
      authData - the complete encoding of the AuthenticatedData structure (a CMS ContentInfo). The array must hold the entire encoding and nothing extra - trailing bytes beyond the AuthenticatedData are not permitted.
      Throws:
      CMSException - if the encoding cannot be parsed as an AuthenticatedData.
    • CMSAuthenticatedData

      public CMSAuthenticatedData(byte[] authData, DigestCalculatorProvider digestCalculatorProvider) throws CMSException
      Create a CMSAuthenticatedData object from its encoding.
      Parameters:
      authData - the complete encoding of the AuthenticatedData structure (a CMS ContentInfo). The array must hold the entire encoding and nothing extra - trailing bytes beyond the AuthenticatedData are not permitted.
      digestCalculatorProvider - provider for the digest calculators needed to verify the MAC.
      Throws:
      CMSException - if the encoding cannot be parsed as an AuthenticatedData.
    • CMSAuthenticatedData

      public CMSAuthenticatedData(InputStream authData) throws CMSException
      Create a CMSAuthenticatedData object from a stream.
      Parameters:
      authData - a stream positioned at the start of the AuthenticatedData encoding (a CMS ContentInfo).
      Throws:
      CMSException - if the encoding cannot be parsed as an AuthenticatedData.
    • CMSAuthenticatedData

      public CMSAuthenticatedData(InputStream authData, DigestCalculatorProvider digestCalculatorProvider) throws CMSException
      Create a CMSAuthenticatedData object from a stream.
      Parameters:
      authData - a stream positioned at the start of the AuthenticatedData encoding (a CMS ContentInfo).
      digestCalculatorProvider - provider for the digest calculators needed to verify the MAC.
      Throws:
      CMSException - if the encoding cannot be parsed as an AuthenticatedData.
    • CMSAuthenticatedData

      public CMSAuthenticatedData(org.bouncycastle.asn1.cms.ContentInfo contentInfo) throws CMSException
      Create a CMSAuthenticatedData object from an already-parsed ContentInfo.
      Parameters:
      contentInfo - the ContentInfo carrying the AuthenticatedData.
      Throws:
      CMSException - if the ContentInfo does not hold a well-formed AuthenticatedData.
    • CMSAuthenticatedData

      public CMSAuthenticatedData(org.bouncycastle.asn1.cms.ContentInfo contentInfo, DigestCalculatorProvider digestCalculatorProvider) throws CMSException
      Create a CMSAuthenticatedData object from an already-parsed ContentInfo.
      Parameters:
      contentInfo - the ContentInfo carrying the AuthenticatedData.
      digestCalculatorProvider - provider for the digest calculators needed to verify the MAC.
      Throws:
      CMSException - if the ContentInfo does not hold a well-formed AuthenticatedData.
  • Method Details

    • getOriginatorInfo

      public OriginatorInformation getOriginatorInfo()
      Return the originator information associated with this message if present.
      Returns:
      OriginatorInformation, null if not present.
    • getMac

      public byte[] getMac()
    • getMacAlgorithm

      public org.bouncycastle.asn1.x509.AlgorithmIdentifier getMacAlgorithm()
      Return the MAC algorithm details for the MAC associated with the data in this object.
      Returns:
      AlgorithmIdentifier representing the MAC algorithm.
    • getMacAlgOID

      public String getMacAlgOID()
      return the object identifier for the content MAC algorithm.
    • getMacAlgParams

      public byte[] getMacAlgParams()
      return the ASN.1 encoded MAC algorithm parameters, or null if there aren't any.
    • getRecipientInfos

      public RecipientInformationStore getRecipientInfos()
      return a store of the intended recipients for this message
    • getContentInfo

      public org.bouncycastle.asn1.cms.ContentInfo getContentInfo()
      Deprecated.
      use toASN1Structure()
      return the ContentInfo
    • toASN1Structure

      public org.bouncycastle.asn1.cms.ContentInfo toASN1Structure()
      return the ContentInfo
    • getAuthAttrs

      public org.bouncycastle.asn1.cms.AttributeTable getAuthAttrs()
      Deprecated.
      Use getAuthAttributes() instead.
      return a table of the digested attributes indexed by the OID of the attribute.
    • getAuthAttributes

      public org.bouncycastle.asn1.cms.AttributeTable getAuthAttributes()
      return a table of the authenticated attributes - indexed by the OID of the attribute.
    • getUnauthAttrs

      public org.bouncycastle.asn1.cms.AttributeTable getUnauthAttrs()
      Deprecated.
      return a table of the undigested attributes indexed by the OID of the attribute.
    • getUnauthAttributes

      public org.bouncycastle.asn1.cms.AttributeTable getUnauthAttributes()
      return a table of the unauthenticated attributes - indexed by the OID of the attribute.
    • getEncoded

      public byte[] getEncoded() throws IOException
      return the ASN.1 encoded representation of this object.
      Specified by:
      getEncoded in interface org.bouncycastle.util.Encodable
      Throws:
      IOException
    • getContentDigest

      public byte[] getContentDigest()