EnvelopedCms.Encrypt 方法  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
加密 CMS/PKCS#7 消息的内容。
重载
| Encrypt() | 在通过 UI 弹出窗口选择收件人证书之后,对 CMS/PKCS#7 消息的内容进行加密。 | 
| Encrypt(CmsRecipient) | 针对单个指定收件人,对 CMS/PKCS#7 消息的内容进行加密。 | 
| Encrypt(CmsRecipientCollection) | 针对一个或多个收件人,对 CMS/PKCS#7 消息的内容进行加密。 | 
Encrypt()
在通过 UI 弹出窗口选择收件人证书之后,对 CMS/PKCS#7 消息的内容进行加密。
public:
 void Encrypt();public void Encrypt ();member this.Encrypt : unit -> unitPublic Sub Encrypt ()例外
未能完成加密操作。
注解
此方法显示一个用户界面,可在其中选择要为其加密邮件的收件人。 这要求当前进程在 用户交互模式下运行,这意味着 属性 Environment.UserInteractive 为 true。 进程通常处于用户交互模式,除非它是服务进程或在 Web 应用程序中运行。
用户界面将仅显示在其有效期内且密钥使用中包含密钥加密或密钥协议的证书。
需要以下权限才能在 .NET Framework 上显示用户界面:
适用于
Encrypt(CmsRecipient)
- Source:
- EnvelopedCms.cs
- Source:
- EnvelopedCms.cs
- Source:
- EnvelopedCms.cs
针对单个指定收件人,对 CMS/PKCS#7 消息的内容进行加密。
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 -> unitPublic Sub Encrypt (recipient As CmsRecipient)参数
- recipient
- CmsRecipient
描述此消息的单个收件人的收件人信息。
例外
              recipient 参数为 null。
未能完成加密操作。
另请参阅
适用于
Encrypt(CmsRecipientCollection)
- Source:
- EnvelopedCms.cs
- Source:
- EnvelopedCms.cs
- Source:
- EnvelopedCms.cs
针对一个或多个收件人,对 CMS/PKCS#7 消息的内容进行加密。
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 -> unitPublic Sub Encrypt (recipients As CmsRecipientCollection)参数
- recipients
- CmsRecipientCollection
描述消息收件人的集合。
例外
              recipients 参数为 null。
未能完成加密操作。