<PackageReference Include="System.Security.Cryptography.Pkcs" Version="11.0.0-preview.5.26302.115" />

System.Security.Cryptography.Pkcs.SignedCms

public sealed class SignedCms
The SignedCms class enables signing and verifying of CMS/PKCS #7 messages.

The Certificates property retrieves the certificates associated with the encoded CMS/PKCS #7 message.

public ContentInfo ContentInfo { get; }

The ContentInfo property retrieves the inner contents of the encoded CMS/PKCS #7 message.

public bool Detached { get; }

The Detached property retrieves whether the SignedCms object is for a detached signature.

The SignerInfos property retrieves the SignerInfoCollection collection associated with the CMS/PKCS #7 message.

public int Version { get; }

The Version property retrieves the version of the CMS/PKCS #7 message.

public SignedCms(SubjectIdentifierType signerIdentifierType, ContentInfo contentInfo, bool detached)

The #ctor constructor creates an instance of the SignedCms class by using the specified subject identifier type as the default subject identifier type for signers, the content information as the inner content, and by using the detached state.

public SignedCms()

The #ctor constructor creates an instance of the SignedCms class.

public SignedCms(SubjectIdentifierType signerIdentifierType)

The #ctor constructor creates an instance of the SignedCms class by using the specified subject identifier type as the default subject identifier type for signers.

public SignedCms(ContentInfo contentInfo)

The #ctor constructor creates an instance of the SignedCms class by using the specified content information as the inner content.

public SignedCms(SubjectIdentifierType signerIdentifierType, ContentInfo contentInfo)

The #ctor constructor creates an instance of the SignedCms class by using the specified subject identifier type as the default subject identifier type for signers and content information as the inner content.

public SignedCms(ContentInfo contentInfo, bool detached)

The #ctor constructor creates an instance of the SignedCms class by using the specified content information as the inner content and by using the detached state.

public void AddCertificate(X509Certificate2 certificate)

Adds a certificate to the collection of certificates for the encoded CMS/PKCS #7 message.

public void CheckHash()

The CheckHash method verifies the data integrity of the CMS/PKCS #7 message. CheckHash is a specialized method used in specific security infrastructure applications that only wish to check the hash of the CMS message, rather than perform a full digital signature verification. CheckHash does not authenticate the author nor sender of the message because this method does not involve verifying a digital signature. For general-purpose checking of the integrity and authenticity of a CMS/PKCS #7 message, use the CheckSignature or CheckSignature methods.

public void CheckSignature(bool verifySignatureOnly)

The CheckSignature method verifies the digital signatures on the signed CMS/PKCS #7 message and, optionally, validates the signers' certificates.

public void CheckSignature(X509Certificate2Collection extraStore, bool verifySignatureOnly)

The CheckSignature method verifies the digital signatures on the signed CMS/PKCS #7 message by using the specified collection of certificates and, optionally, validates the signers' certificates.

public void ComputeSignature()

Creates a signature and adds the signature to the CMS/PKCS #7 message.

public void ComputeSignature(CmsSigner signer)

Creates a signature using the specified signer and adds the signature to the CMS/PKCS #7 message.

public void ComputeSignature(CmsSigner signer, bool silent)

Creates a signature using the specified signer and adds the signature to the CMS/PKCS #7 message.

public void Decode(byte[] encodedMessage)

Decodes an encoded SignedCms message.

public void Decode(ReadOnlySpan<byte> encodedMessage)

public byte[] Encode()

The Encode method encodes the information in the object into a CMS/PKCS #7 message.

public void RemoveCertificate(X509Certificate2 certificate)

Removes the specified certificate from the collection of certificates for the encoded CMS/PKCS #7 message.

public void RemoveSignature(int index)

Removes the signature at the specified index of the SignerInfos collection.

public void RemoveSignature(SignerInfo signerInfo)

The RemoveSignature method removes the signature for the specified SignerInfo object.