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

System.Security.Cryptography.Pkcs.EnvelopedCms

public sealed class EnvelopedCms
Represents a CMS/PKCS#7 structure for enveloped data.

Gets the collection of certificates associated with the enveloped CMS/PKCS#7 message.

Gets the identifier of the symmetric encryption algorithm associated with this message.

public ContentInfo ContentInfo { get; }

Gets the content information for the enveloped CMS/PKCS#7 message.

Gets a collection that represents the recipients list for a decoded message. The default value is an empty collection.

Gets the collection of unprotected (unencrypted) attributes associated with the enveloped CMS/PKCS#7 message.

public int Version { get; }

Gets the version of the decoded enveloped CMS/PKCS#7 message.

public EnvelopedCms()

Initializes a new instance of the EnvelopedCms class with default values.

public EnvelopedCms(ContentInfo contentInfo)

Initializes a new instance of the EnvelopedCms class with specified content information.

public EnvelopedCms(ContentInfo contentInfo, AlgorithmIdentifier encryptionAlgorithm)

Initializes a new instance of the EnvelopedCms class with a specified symmetric encryption algorithm and content information.

public void Decode(byte[] encodedMessage)

Decodes an array of bytes as a CMS/PKCS#7 EnvelopedData message.

public void Decode(ReadOnlySpan<byte> encodedMessage)

Decodes the provided data as a CMS/PKCS#7 EnvelopedData message.

public void Decrypt()

Decrypts the contents of the decoded enveloped CMS/PKCS#7 message via any available recipient by searching certificate stores for a matching certificate and key.

public void Decrypt(RecipientInfo recipientInfo)

Decrypts the contents of the decoded enveloped CMS/PKCS#7 message via a specified recipient info by searching certificate stores for a matching certificate and key.

public void Decrypt(RecipientInfo recipientInfo, X509Certificate2Collection extraStore)

Decrypts the contents of the decoded enveloped CMS/PKCS#7 message via a specified recipient info by searching certificate stores and a provided collection for a matching certificate and key.

public void Decrypt(X509Certificate2Collection extraStore)

Decrypts the contents of the decoded enveloped CMS/PKCS#7 message via any available recipient info by searching certificate stores and a provided collection for a matching certificate and key.

public void Decrypt(RecipientInfo recipientInfo, AsymmetricAlgorithm privateKey)

Decrypts the contents of the decoded enveloped CMS/PKCS#7 message via a specified recipient info with a specified private key.

public byte[] Encode()

Encodes the contents of the enveloped CMS/PKCS#7 message and returns it as a byte array.

public void Encrypt(CmsRecipient recipient)

Encrypts the contents of the CMS/PKCS#7 message for a single specified recipient.

public void Encrypt(CmsRecipientCollection recipients)

Encrypts the contents of the CMS/PKCS#7 message for one or more recipients.