SignedCms Class

Definition

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

public sealed class SignedCms
Inheritance
SignedCms

Remarks

The Cryptographic Message Syntax RFC specifies the following MIME types and file name extensions for CMS/PKCS #7 messages with these content types.

Content type MIME type Extension
envelopedData application/pkcs7-mime .p7m
signedData application/pkcs7-signature .p7s.p7c

Constructors

SignedCms()

The SignedCms() constructor creates an instance of the SignedCms class.

SignedCms(ContentInfo, Boolean)

The SignedCms(ContentInfo, Boolean) constructor creates an instance of the SignedCms class by using the specified content information as the inner content and by using the detached state.

SignedCms(ContentInfo)

The SignedCms(ContentInfo) constructor creates an instance of the SignedCms class by using the specified content information as the inner content.

SignedCms(SubjectIdentifierType, ContentInfo, Boolean)

The SignedCms(SubjectIdentifierType, ContentInfo, Boolean) 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.

SignedCms(SubjectIdentifierType, ContentInfo)

The SignedCms(SubjectIdentifierType, ContentInfo) 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.

SignedCms(SubjectIdentifierType)

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

Properties

Certificates

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

ContentInfo

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

Detached

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

SignerInfos

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

Version

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

Methods

AddCertificate(X509Certificate2)

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

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(Boolean) or CheckSignature(X509Certificate2Collection, Boolean) methods.

CheckSignature(Boolean)

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

CheckSignature(X509Certificate2Collection, Boolean)

The CheckSignature(X509Certificate2Collection, Boolean) 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.

ComputeSignature()

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

ComputeSignature(CmsSigner, Boolean)

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

ComputeSignature(CmsSigner)

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

Decode(Byte[])

Decodes an encoded SignedCms message.

Decode(ReadOnlySpan<Byte>)
Encode()

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

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
RemoveCertificate(X509Certificate2)

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

RemoveSignature(Int32)

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

RemoveSignature(SignerInfo)

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

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

Product Versies
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided), 2.1 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9