EnvelopedCms.Encrypt Method (CmsRecipientCollection)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

The Encrypt(CmsRecipientCollection) method encrypts the contents of the CMS/PKCS #7 message by using the information for the specified list of recipients. The message is encrypted by using a message encryption key with a symmetric encryption algorithm such as triple DES. The message encryption key is then encrypted with the public key of each recipient.

Namespace:   System.Security.Cryptography.Pkcs
Assembly:  System.Security (in System.Security.dll)

public void Encrypt(
	CmsRecipientCollection recipients


Type: System.Security.Cryptography.Pkcs.CmsRecipientCollection

A CmsRecipientCollection collection that represents the information for the list of recipients.

Exception Condition

A null reference was passed to a method that does not accept it as a valid argument.


A cryptographic operation could not be completed.

The Encrypt(CmsRecipientCollection) method does not cause the EnvelopedCms.RecipientInfos property to be populated.

.NET Framework
Available since 2.0
Return to top