Redigera

Dela via


EnvelopedCms.Encrypt Method

Definition

Encrypts the contents of the CMS/PKCS#7 message.

Overloads

Encrypt()

Encrypts the contents of the CMS/PKCS#7 message after selecting recipient certificates via a UI popup.

Encrypt(CmsRecipient)

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

Encrypt(CmsRecipientCollection)

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

Encrypt()

Encrypts the contents of the CMS/PKCS#7 message after selecting recipient certificates via a UI popup.

public:
 void Encrypt();
public void Encrypt ();
member this.Encrypt : unit -> unit
Public Sub Encrypt ()

Exceptions

A cryptographic operation could not be completed.

Remarks

This method displays a user interface in which you choose the recipients for whom to encrypt the message. This requires that the current process is running in user interactive mode, meaning that the Environment.UserInteractive property is true. A process is normally in user interactive mode unless it is a service process or running inside a Web application.

The user interface will only present certificates that are within their validity period and that have Key Encipherment or Key Agreement included in their key usage.

The following permissions are required to display the user interface on .NET Framework:

Applies to

Encrypt(CmsRecipient)

Source:
EnvelopedCms.cs
Source:
EnvelopedCms.cs
Source:
EnvelopedCms.cs
Source:
EnvelopedCms.cs
Source:
EnvelopedCms.cs

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

public:
 void Encrypt(System::Security::Cryptography::Pkcs::CmsRecipient ^ recipient);
public void Encrypt (System.Security.Cryptography.Pkcs.CmsRecipient recipient);
member this.Encrypt : System.Security.Cryptography.Pkcs.CmsRecipient -> unit
Public Sub Encrypt (recipient As CmsRecipient)

Parameters

recipient
CmsRecipient

The recipient information describing the single recipient of this message.

Exceptions

The recipient parameter is null.

A cryptographic operation could not be completed.

See also

Applies to

Encrypt(CmsRecipientCollection)

Source:
EnvelopedCms.cs
Source:
EnvelopedCms.cs
Source:
EnvelopedCms.cs
Source:
EnvelopedCms.cs
Source:
EnvelopedCms.cs

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

public:
 void Encrypt(System::Security::Cryptography::Pkcs::CmsRecipientCollection ^ recipients);
public void Encrypt (System.Security.Cryptography.Pkcs.CmsRecipientCollection recipients);
member this.Encrypt : System.Security.Cryptography.Pkcs.CmsRecipientCollection -> unit
Public Sub Encrypt (recipients As CmsRecipientCollection)

Parameters

recipients
CmsRecipientCollection

A collection describing the recipients for the message.

Exceptions

The recipients parameter is null.

A cryptographic operation could not be completed.

Applies to