EnvelopedCms Class

The EnvelopedCms class represents a CMS/PKCS #7 structure for enveloped data.

System.Object
  System.Security.Cryptography.Pkcs.EnvelopedCms

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

[HostProtectionAttribute(SecurityAction.LinkDemand, MayLeakOnAbort = true)]
public sealed class EnvelopedCms

The EnvelopedCms type exposes the following members.

  NameDescription
Public methodEnvelopedCms()The EnvelopedCms() constructor creates an instance of the EnvelopedCms class.
Public methodEnvelopedCms(ContentInfo)The EnvelopedCms(ContentInfo) constructor creates an instance of the EnvelopedCms class by using the specified content information as the inner content type.
Public methodEnvelopedCms(ContentInfo, AlgorithmIdentifier)The EnvelopedCms(ContentInfo, AlgorithmIdentifier) constructor creates an instance of the EnvelopedCms class by using the specified content information and encryption algorithm. The specified content information is to be used as the inner content type.
Public methodEnvelopedCms(SubjectIdentifierType, ContentInfo)The EnvelopedCms(SubjectIdentifierType, ContentInfo) constructor creates an instance of the EnvelopedCms class by using the specified subject identifier type and content information. The specified content information is to be used as the inner content type.
Public methodEnvelopedCms(SubjectIdentifierType, ContentInfo, AlgorithmIdentifier)The EnvelopedCms(SubjectIdentifierType, ContentInfo, AlgorithmIdentifier) constructor creates an instance of the EnvelopedCms class by using the specified subject identifier type, content information, and encryption algorithm. The specified content information is to be used as the inner content type.
Top

  NameDescription
Public propertyCertificatesThe Certificates property retrieves the set of certificates associated with the enveloped CMS/PKCS #7 message.
Public propertyContentEncryptionAlgorithmThe ContentEncryptionAlgorithm property retrieves the identifier of the algorithm used to encrypt the content.
Public propertyContentInfoThe ContentInfo property retrieves the inner content information for the enveloped CMS/PKCS #7 message.
Public propertyRecipientInfosThe RecipientInfos property retrieves the recipient information associated with the enveloped CMS/PKCS #7 message.
Public propertyUnprotectedAttributesThe UnprotectedAttributes property retrieves the unprotected (unencrypted) attributes associated with the enveloped CMS/PKCS #7 message. Unprotected attributes are not encrypted, and so do not have data confidentiality within an EnvelopedCms object.
Public propertyVersionThe Version property retrieves the version of the enveloped CMS/PKCS #7 message.
Top

  NameDescription
Public methodDecodeThe Decode method decodes the specified enveloped CMS/PKCS #7 message and resets all member variables in the EnvelopedCms object.
Public methodDecrypt()The Decrypt() method decrypts the contents of the decoded enveloped CMS/PKCS #7 message. The Decrypt() method searches the current user and computer My stores for the appropriate certificate and private key.
Public methodDecrypt(RecipientInfo)The Decrypt(RecipientInfo) method decrypts the contents of the decoded enveloped CMS/PKCS #7 message by using the private key associated with the certificate identified by the specified recipient information.
Public methodDecrypt(X509Certificate2Collection)The Decrypt(X509Certificate2Collection) method decrypts the contents of the decoded enveloped CMS/PKCS #7 message by using the specified certificate collection. The Decrypt(X509Certificate2Collection) method searches the specified certificate collection and the My certificate store for the proper certificate to use for the decryption.
Public methodDecrypt(RecipientInfo, X509Certificate2Collection)The Decrypt(RecipientInfo, X509Certificate2Collection) method decrypts the contents of the decoded enveloped CMS/PKCS #7 message by using the private key associated with the certificate identified by the specified recipient information and by using the specified certificate collection. The Decrypt(RecipientInfo, X509Certificate2Collection) method searches the specified certificate collection and the My certificate store for the proper certificate to use for the decryption.
Public methodEncodeThe Encode method encodes the contents of the enveloped CMS/PKCS #7 message and returns it as an array of byte values. Encryption must be done before encoding.
Public methodEncrypt()The Encrypt() method encrypts the contents of the CMS/PKCS #7 message.
Public methodEncrypt(CmsRecipient)The Encrypt(CmsRecipient) method encrypts the contents of the CMS/PKCS #7 message by using the specified recipient information.
Public methodEncrypt(CmsRecipientCollection)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.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

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

NoteNote

The HostProtectionAttribute attribute applied to this type or member has the following Resources property value: MayLeakOnAbort. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft