From ee6695355a63414cdf9d6405be5cac06c2e2842c Mon Sep 17 00:00:00 2001 From: Konradsop Date: Thu, 30 Jul 2026 16:36:39 +0200 Subject: [PATCH] Add XML documentation for CMS EnvelopedData --- crypto/src/cms/CMSEnvelopedData.cs | 36 +++++++++++++++++------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/crypto/src/cms/CMSEnvelopedData.cs b/crypto/src/cms/CMSEnvelopedData.cs index 0180ee9f4..d5ab6eca1 100644 --- a/crypto/src/cms/CMSEnvelopedData.cs +++ b/crypto/src/cms/CMSEnvelopedData.cs @@ -7,9 +7,11 @@ namespace Org.BouncyCastle.Cms { - /** - * containing class for an CMS Enveloped Data object - */ + /// + /// Represents a CMS EnvelopedData message. Parse an encoded message, obtain recipients from + /// , match one with , then decrypt via + /// . + /// public class CmsEnvelopedData { private readonly ContentInfo m_contentInfo; @@ -17,16 +19,23 @@ public class CmsEnvelopedData private readonly OriginatorInformation m_originatorInformation; private readonly RecipientInformationStore m_recipientInfoStore; + /// Creates an instance from an encoded EnvelopedData message. + /// The DER-encoded CMS ContentInfo bytes. public CmsEnvelopedData(byte[] envelopedData) : this(CmsUtilities.ReadContentInfo(envelopedData)) { } + /// Creates an instance from an encoded EnvelopedData message. + /// A stream containing the DER-encoded CMS ContentInfo. public CmsEnvelopedData(Stream envelopedData) : this(CmsUtilities.ReadContentInfo(envelopedData)) { } + /// Creates an instance from a parsed CMS ContentInfo structure. + /// The CMS ContentInfo wrapping an EnvelopedData object. + /// is null. public CmsEnvelopedData(ContentInfo contentInfo) { m_contentInfo = contentInfo ?? throw new ArgumentNullException(nameof(contentInfo)); @@ -55,35 +64,30 @@ public CmsEnvelopedData(ContentInfo contentInfo) m_recipientInfoStore = CmsEnvelopedHelper.BuildRecipientInformationStore(recipientInfos, secureReadable); } + /// Gets originator certificates and CRLs carried in the message, or null if absent. public OriginatorInformation OriginatorInformation => m_originatorInformation; + /// Gets the content-encryption algorithm identifier. public AlgorithmIdentifier EncryptionAlgorithmID => EnvelopedData.EncryptedContentInfo.ContentEncryptionAlgorithm; - /** - * return the object identifier for the content encryption algorithm. - */ + /// Return the object identifier for the content-encryption algorithm. // TODO[api] Return the OID itself public string EncryptionAlgOid => EncryptionAlgorithmID.Algorithm.GetID(); - /** - * return a store of the intended recipients for this message - */ + /// Returns a store of the intended recipients for this message. public RecipientInformationStore GetRecipientInfos() => m_recipientInfoStore; + /// Gets the CMS ContentInfo wrapper for this message. public ContentInfo ContentInfo => m_contentInfo; + /// Gets the underlying ASN.1 EnvelopedData structure. public EnvelopedData EnvelopedData => m_envelopedData; - /** - * return a table of the unprotected attributes indexed by - * the OID of the attribute. - */ + /// Returns a table of unprotected attributes indexed by attribute OID, or null if absent. public Asn1.Cms.AttributeTable GetUnprotectedAttributes() => EnvelopedData.UnprotectedAttrs?.ToAttributeTable(); - /** - * return the ASN.1 encoded representation of this object. - */ + /// Returns the DER encoding of this message. public byte[] GetEncoded() => m_contentInfo.GetEncoded(); } }