C# Class MimeKit.Cryptography.ApplicationPkcs7Mime

An S/MIME part with a Content-Type of application/pkcs7-mime.
An application/pkcs7-mime is an S/MIME part and may contain encrypted, signed or compressed data (or any combination of the above).
Inheritance: MimePart
Exibir arquivo Open project: nachocove/MimeKit Class Usage Examples

Public Methods

Method Description
Accept ( MimeVisitor visitor ) : void

Dispatches to the specific visit method for this MIME entity.

This default implementation for MimeKit.Cryptography.ApplicationPkcs7Mime nodes calls MimeKit.MimeVisitor.VisitApplicationPkcs7Mime. Override this method to call into a more specific method on a derived visitor class of the MimeKit.MimeVisitor class. However, it should still support unknown visitors by calling MimeKit.MimeVisitor.VisitApplicationPkcs7Mime.

ApplicationPkcs7Mime ( MimeEntityConstructorArgs args ) : System

Initializes a new instance of the MimeKit.Cryptography.ApplicationPkcs7Mime class.

This constructor is used by MimeKit.MimeParser.

ApplicationPkcs7Mime ( SecureMimeType type, Stream stream ) : System

Initializes a new instance of the MimeKit.Cryptography.ApplicationPkcs7Mime class.

Creates a new MIME part with a Content-Type of application/pkcs7-mime and the stream as its content.

Unless you are writing your own pkcs7 implementation, you'll probably want to use the Compress(MimeEntity), Encrypt(CmsRecipientCollection, MimeEntity), and/or Sign(CmsSigner, MimeEntity) method to create new instances of this class.

Compress ( MimeEntity entity ) : ApplicationPkcs7Mime

Compresses the specified entity.

Compresses the specified entity using the default SecureMimeContext.

Most mail clients, even among those that support S/MIME, do not support compression.

Compress ( MimeKit.Cryptography.SecureMimeContext ctx, MimeEntity entity ) : ApplicationPkcs7Mime

Compresses the specified entity.

Compresses the specified entity using the specified SecureMimeContext.

Most mail clients, even among those that support S/MIME, do not support compression.

Decompress ( ) : MimeEntity

Decompresses the content.

Decompresses the content using the default SecureMimeContext.

Decompress ( MimeKit.Cryptography.SecureMimeContext ctx ) : MimeEntity

Decompresses the content.

Decompresses the content using the specified SecureMimeContext.

Decrypt ( ) : MimeEntity

Decrypts the content.

Decrypts the content using the default SecureMimeContext.

Decrypt ( MimeKit.Cryptography.SecureMimeContext ctx ) : MimeEntity

Decrypts the content.

Decrypts the content using the specified SecureMimeContext.

Encrypt ( CmsRecipientCollection recipients, MimeEntity entity ) : ApplicationPkcs7Mime

Encrypts the specified entity.

Encrypts the entity to the specified recipients using the default SecureMimeContext.

Encrypt ( IEnumerable recipients, MimeEntity entity ) : ApplicationPkcs7Mime

Encrypts the specified entity.

Encrypts the entity to the specified recipients using the default SecureMimeContext.

Encrypt ( MimeKit.Cryptography.SecureMimeContext ctx, CmsRecipientCollection recipients, MimeEntity entity ) : ApplicationPkcs7Mime

Encrypts the specified entity.

Encrypts the entity to the specified recipients using the supplied SecureMimeContext.

Encrypt ( MimeKit.Cryptography.SecureMimeContext ctx, IEnumerable recipients, MimeEntity entity ) : ApplicationPkcs7Mime

Encrypts the specified entity.

Encrypts the entity to the specified recipients using the supplied SecureMimeContext.

Import ( MimeKit.Cryptography.SecureMimeContext ctx ) : void

Imports the certificates contained in the content.

Imports the certificates contained in the content.

Sign ( CmsSigner signer, MimeEntity entity ) : ApplicationPkcs7Mime

Cryptographically signs the specified entity.

Signs the entity using the supplied signer.

For better interoperability with other mail clients, you should use MultipartSigned.Create(SecureMimeContext, CmsSigner, MimeEntity) instead as the multipart/signed format is supported among a much larger subset of mail client software.

Sign ( MailboxAddress signer, DigestAlgorithm digestAlgo, MimeEntity entity ) : ApplicationPkcs7Mime

Cryptographically signs the specified entity.

Signs the entity using the supplied signer and digest algorithm.

For better interoperability with other mail clients, you should use MultipartSigned.Create(SecureMimeContext, CmsSigner, MimeEntity) instead as the multipart/signed format is supported among a much larger subset of mail client software.

Sign ( MimeKit.Cryptography.SecureMimeContext ctx, CmsSigner signer, MimeEntity entity ) : ApplicationPkcs7Mime

Cryptographically signs the specified entity.

Signs the entity using the supplied signer and SecureMimeContext.

For better interoperability with other mail clients, you should use MultipartSigned.Create(SecureMimeContext, CmsSigner, MimeEntity) instead as the multipart/signed format is supported among a much larger subset of mail client software.

Sign ( MimeKit.Cryptography.SecureMimeContext ctx, MailboxAddress signer, DigestAlgorithm digestAlgo, MimeEntity entity ) : ApplicationPkcs7Mime

Cryptographically signs the specified entity.

Signs the entity using the supplied signer, digest algorithm and SecureMimeContext.

For better interoperability with other mail clients, you should use MultipartSigned.Create(SecureMimeContext, CmsSigner, MimeEntity) instead as the multipart/signed format is supported among a much larger subset of mail client software.

SignAndEncrypt ( CmsSigner signer, CmsRecipientCollection recipients, MimeEntity entity ) : ApplicationPkcs7Mime

Cryptographically signs and encrypts the specified entity.

Cryptographically signs entity using the supplied signer and then encrypts the result to the specified recipients.

SignAndEncrypt ( MailboxAddress signer, DigestAlgorithm digestAlgo, IEnumerable recipients, MimeEntity entity ) : ApplicationPkcs7Mime

Cryptographically signs and encrypts the specified entity.

Cryptographically signs entity using the supplied signer and then encrypts the result to the specified recipients.

SignAndEncrypt ( MimeKit.Cryptography.SecureMimeContext ctx, CmsSigner signer, CmsRecipientCollection recipients, MimeEntity entity ) : ApplicationPkcs7Mime

Cryptographically signs and encrypts the specified entity.

Cryptographically signs entity using the supplied signer and then encrypts the result to the specified recipients.

SignAndEncrypt ( MimeKit.Cryptography.SecureMimeContext ctx, MailboxAddress signer, DigestAlgorithm digestAlgo, IEnumerable recipients, MimeEntity entity ) : ApplicationPkcs7Mime

Cryptographically signs and encrypts the specified entity.

Cryptographically signs entity using the supplied signer and then encrypts the result to the specified recipients.

Verify ( MimeEntity &entity ) : DigitalSignatureCollection

Verifies the signed-data and returns the unencapsulated MimeKit.MimeEntity.

Verifies the signed-data and returns the unencapsulated MimeKit.MimeEntity.

Verify ( MimeKit.Cryptography.SecureMimeContext ctx, MimeEntity &entity ) : DigitalSignatureCollection

Verifies the signed-data and returns the unencapsulated MimeKit.MimeEntity.

Verifies the signed-data and returns the unencapsulated MimeKit.MimeEntity.

Method Details

Accept() public method

Dispatches to the specific visit method for this MIME entity.
This default implementation for MimeKit.Cryptography.ApplicationPkcs7Mime nodes calls MimeKit.MimeVisitor.VisitApplicationPkcs7Mime. Override this method to call into a more specific method on a derived visitor class of the MimeKit.MimeVisitor class. However, it should still support unknown visitors by calling MimeKit.MimeVisitor.VisitApplicationPkcs7Mime.
/// is null. ///
public Accept ( MimeVisitor visitor ) : void
visitor MimeVisitor The visitor.
return void

ApplicationPkcs7Mime() public method

Initializes a new instance of the MimeKit.Cryptography.ApplicationPkcs7Mime class.
This constructor is used by MimeKit.MimeParser.
/// is null. ///
public ApplicationPkcs7Mime ( MimeEntityConstructorArgs args ) : System
args MimeEntityConstructorArgs Information used by the constructor.
return System

ApplicationPkcs7Mime() public method

Initializes a new instance of the MimeKit.Cryptography.ApplicationPkcs7Mime class.

Creates a new MIME part with a Content-Type of application/pkcs7-mime and the stream as its content.

Unless you are writing your own pkcs7 implementation, you'll probably want to use the Compress(MimeEntity), Encrypt(CmsRecipientCollection, MimeEntity), and/or Sign(CmsSigner, MimeEntity) method to create new instances of this class.

/// is null. /// /// is not a valid value. /// /// does not support reading. /// -or- /// does not support seeking. ///
public ApplicationPkcs7Mime ( SecureMimeType type, Stream stream ) : System
type SecureMimeType The S/MIME type.
stream Stream The content stream.
return System

Compress() public static method

Compresses the specified entity.

Compresses the specified entity using the default SecureMimeContext.

Most mail clients, even among those that support S/MIME, do not support compression.

/// is null. /// /// An error occurred in the cryptographic message syntax subsystem. ///
public static Compress ( MimeEntity entity ) : ApplicationPkcs7Mime
entity MimeEntity The entity.
return ApplicationPkcs7Mime

Compress() public static method

Compresses the specified entity.

Compresses the specified entity using the specified SecureMimeContext.

Most mail clients, even among those that support S/MIME, do not support compression.

/// is null. /// -or- /// is null. /// /// An error occurred in the cryptographic message syntax subsystem. ///
public static Compress ( MimeKit.Cryptography.SecureMimeContext ctx, MimeEntity entity ) : ApplicationPkcs7Mime
ctx MimeKit.Cryptography.SecureMimeContext The S/MIME context to use for compressing.
entity MimeEntity The entity.
return ApplicationPkcs7Mime

Decompress() public method

Decompresses the content.
Decompresses the content using the default SecureMimeContext.
/// The "smime-type" parameter on the Content-Type header is not "compressed-data". /// /// An error occurred in the cryptographic message syntax subsystem. ///
public Decompress ( ) : MimeEntity
return MimeEntity

Decompress() public method

Decompresses the content.
Decompresses the content using the specified SecureMimeContext.
/// is null. /// /// The "smime-type" parameter on the Content-Type header is not "compressed-data". /// /// An error occurred in the cryptographic message syntax subsystem. ///
public Decompress ( MimeKit.Cryptography.SecureMimeContext ctx ) : MimeEntity
ctx MimeKit.Cryptography.SecureMimeContext The S/MIME context to use for decompressing.
return MimeEntity

Decrypt() public method

Decrypts the content.
Decrypts the content using the default SecureMimeContext.
/// The "smime-type" parameter on the Content-Type header is not "certs-only". /// /// An error occurred in the cryptographic message syntax subsystem. ///
public Decrypt ( ) : MimeEntity
return MimeEntity

Decrypt() public method

Decrypts the content.
Decrypts the content using the specified SecureMimeContext.
/// is null. /// /// The "smime-type" parameter on the Content-Type header is not "enveloped-data". /// /// An error occurred in the cryptographic message syntax subsystem. ///
public Decrypt ( MimeKit.Cryptography.SecureMimeContext ctx ) : MimeEntity
ctx MimeKit.Cryptography.SecureMimeContext The S/MIME context to use for decrypting.
return MimeEntity

Encrypt() public static method

Encrypts the specified entity.
Encrypts the entity to the specified recipients using the default SecureMimeContext.
/// is null. /// -or- /// is null. /// /// An error occurred in the cryptographic message syntax subsystem. ///
public static Encrypt ( CmsRecipientCollection recipients, MimeEntity entity ) : ApplicationPkcs7Mime
recipients CmsRecipientCollection The recipients.
entity MimeEntity The entity.
return ApplicationPkcs7Mime

Encrypt() public static method

Encrypts the specified entity.
Encrypts the entity to the specified recipients using the default SecureMimeContext.
/// is null. /// -or- /// is null. /// /// Valid certificates could not be found for one or more of the . /// /// A certificate could not be found for one or more of the . /// /// An error occurred in the cryptographic message syntax subsystem. ///
public static Encrypt ( IEnumerable recipients, MimeEntity entity ) : ApplicationPkcs7Mime
recipients IEnumerable The recipients.
entity MimeEntity The entity.
return ApplicationPkcs7Mime

Encrypt() public static method

Encrypts the specified entity.
Encrypts the entity to the specified recipients using the supplied SecureMimeContext.
/// is null. /// -or- /// is null. /// -or- /// is null. /// /// An error occurred in the cryptographic message syntax subsystem. ///
public static Encrypt ( MimeKit.Cryptography.SecureMimeContext ctx, CmsRecipientCollection recipients, MimeEntity entity ) : ApplicationPkcs7Mime
ctx MimeKit.Cryptography.SecureMimeContext The S/MIME context to use for encrypting.
recipients CmsRecipientCollection The recipients.
entity MimeEntity The entity.
return ApplicationPkcs7Mime

Encrypt() public static method

Encrypts the specified entity.
Encrypts the entity to the specified recipients using the supplied SecureMimeContext.
/// is null. /// -or- /// is null. /// -or- /// is null. /// /// Valid certificates could not be found for one or more of the . /// /// A certificate could not be found for one or more of the . /// /// An error occurred in the cryptographic message syntax subsystem. ///
public static Encrypt ( MimeKit.Cryptography.SecureMimeContext ctx, IEnumerable recipients, MimeEntity entity ) : ApplicationPkcs7Mime
ctx MimeKit.Cryptography.SecureMimeContext The S/MIME context to use for encrypting.
recipients IEnumerable The recipients.
entity MimeEntity The entity.
return ApplicationPkcs7Mime

Import() public method

Imports the certificates contained in the content.
Imports the certificates contained in the content.
/// is null. /// /// The "smime-type" parameter on the Content-Type header is not "certs-only". /// /// An error occurred in the cryptographic message syntax subsystem. ///
public Import ( MimeKit.Cryptography.SecureMimeContext ctx ) : void
ctx MimeKit.Cryptography.SecureMimeContext The S/MIME context to import certificates into.
return void

Sign() public static method

Cryptographically signs the specified entity.

Signs the entity using the supplied signer.

For better interoperability with other mail clients, you should use MultipartSigned.Create(SecureMimeContext, CmsSigner, MimeEntity) instead as the multipart/signed format is supported among a much larger subset of mail client software.

/// is null. /// -or- /// is null. /// /// An error occurred in the cryptographic message syntax subsystem. ///
public static Sign ( CmsSigner signer, MimeEntity entity ) : ApplicationPkcs7Mime
signer CmsSigner The signer.
entity MimeEntity The entity.
return ApplicationPkcs7Mime

Sign() public static method

Cryptographically signs the specified entity.

Signs the entity using the supplied signer and digest algorithm.

For better interoperability with other mail clients, you should use MultipartSigned.Create(SecureMimeContext, CmsSigner, MimeEntity) instead as the multipart/signed format is supported among a much larger subset of mail client software.

/// is null. /// -or- /// is null. /// /// A signing certificate could not be found for . /// /// An error occurred in the cryptographic message syntax subsystem. ///
public static Sign ( MailboxAddress signer, DigestAlgorithm digestAlgo, MimeEntity entity ) : ApplicationPkcs7Mime
signer MailboxAddress The signer.
digestAlgo DigestAlgorithm The digest algorithm to use for signing.
entity MimeEntity The entity.
return ApplicationPkcs7Mime

Sign() public static method

Cryptographically signs the specified entity.

Signs the entity using the supplied signer and SecureMimeContext.

For better interoperability with other mail clients, you should use MultipartSigned.Create(SecureMimeContext, CmsSigner, MimeEntity) instead as the multipart/signed format is supported among a much larger subset of mail client software.

/// is null. /// -or- /// is null. /// -or- /// is null. /// /// An error occurred in the cryptographic message syntax subsystem. ///
public static Sign ( MimeKit.Cryptography.SecureMimeContext ctx, CmsSigner signer, MimeEntity entity ) : ApplicationPkcs7Mime
ctx MimeKit.Cryptography.SecureMimeContext The S/MIME context to use for signing.
signer CmsSigner The signer.
entity MimeEntity The entity.
return ApplicationPkcs7Mime

Sign() public static method

Cryptographically signs the specified entity.

Signs the entity using the supplied signer, digest algorithm and SecureMimeContext.

For better interoperability with other mail clients, you should use MultipartSigned.Create(SecureMimeContext, CmsSigner, MimeEntity) instead as the multipart/signed format is supported among a much larger subset of mail client software.

/// is null. /// -or- /// is null. /// -or- /// is null. /// /// A signing certificate could not be found for . /// /// An error occurred in the cryptographic message syntax subsystem. ///
public static Sign ( MimeKit.Cryptography.SecureMimeContext ctx, MailboxAddress signer, DigestAlgorithm digestAlgo, MimeEntity entity ) : ApplicationPkcs7Mime
ctx MimeKit.Cryptography.SecureMimeContext The S/MIME context to use for signing.
signer MailboxAddress The signer.
digestAlgo DigestAlgorithm The digest algorithm to use for signing.
entity MimeEntity The entity.
return ApplicationPkcs7Mime

SignAndEncrypt() public static method

Cryptographically signs and encrypts the specified entity.
Cryptographically signs entity using the supplied signer and then encrypts the result to the specified recipients.
/// is null. /// -or- /// is null. /// -or- /// is null. /// /// An error occurred in the cryptographic message syntax subsystem. ///
public static SignAndEncrypt ( CmsSigner signer, CmsRecipientCollection recipients, MimeEntity entity ) : ApplicationPkcs7Mime
signer CmsSigner The signer.
recipients CmsRecipientCollection The recipients.
entity MimeEntity The entity.
return ApplicationPkcs7Mime

SignAndEncrypt() public static method

Cryptographically signs and encrypts the specified entity.
Cryptographically signs entity using the supplied signer and then encrypts the result to the specified recipients.
/// is null. /// -or- /// is null. /// -or- /// is null. /// /// A signing certificate could not be found for . /// -or- /// A certificate could not be found for one or more of the . /// /// An error occurred in the cryptographic message syntax subsystem. ///
public static SignAndEncrypt ( MailboxAddress signer, DigestAlgorithm digestAlgo, IEnumerable recipients, MimeEntity entity ) : ApplicationPkcs7Mime
signer MailboxAddress The signer.
digestAlgo DigestAlgorithm The digest algorithm to use for signing.
recipients IEnumerable The recipients.
entity MimeEntity The entity.
return ApplicationPkcs7Mime

SignAndEncrypt() public static method

Cryptographically signs and encrypts the specified entity.
Cryptographically signs entity using the supplied signer and then encrypts the result to the specified recipients.
/// is null. /// -or- /// is null. /// -or- /// is null. /// -or- /// is null. /// /// An error occurred in the cryptographic message syntax subsystem. ///
public static SignAndEncrypt ( MimeKit.Cryptography.SecureMimeContext ctx, CmsSigner signer, CmsRecipientCollection recipients, MimeEntity entity ) : ApplicationPkcs7Mime
ctx MimeKit.Cryptography.SecureMimeContext The S/MIME context to use for signing and encrypting.
signer CmsSigner The signer.
recipients CmsRecipientCollection The recipients.
entity MimeEntity The entity.
return ApplicationPkcs7Mime

SignAndEncrypt() public static method

Cryptographically signs and encrypts the specified entity.
Cryptographically signs entity using the supplied signer and then encrypts the result to the specified recipients.
/// is null. /// -or- /// is null. /// -or- /// is null. /// -or- /// is null. /// /// A signing certificate could not be found for . /// -or- /// A certificate could not be found for one or more of the . /// /// An error occurred in the cryptographic message syntax subsystem. ///
public static SignAndEncrypt ( MimeKit.Cryptography.SecureMimeContext ctx, MailboxAddress signer, DigestAlgorithm digestAlgo, IEnumerable recipients, MimeEntity entity ) : ApplicationPkcs7Mime
ctx MimeKit.Cryptography.SecureMimeContext The S/MIME context to use for signing and encrypting.
signer MailboxAddress The signer.
digestAlgo DigestAlgorithm The digest algorithm to use for signing.
recipients IEnumerable The recipients.
entity MimeEntity The entity.
return ApplicationPkcs7Mime

Verify() public method

Verifies the signed-data and returns the unencapsulated MimeKit.MimeEntity.
Verifies the signed-data and returns the unencapsulated MimeKit.MimeEntity.
/// The "smime-type" parameter on the Content-Type header is not "signed-data". /// /// An error occurred in the cryptographic message syntax subsystem. ///
public Verify ( MimeEntity &entity ) : DigitalSignatureCollection
entity MimeEntity The unencapsulated entity.
return DigitalSignatureCollection

Verify() public method

Verifies the signed-data and returns the unencapsulated MimeKit.MimeEntity.
Verifies the signed-data and returns the unencapsulated MimeKit.MimeEntity.
/// is null. /// /// The "smime-type" parameter on the Content-Type header is not "signed-data". /// /// The extracted content could not be parsed as a MIME entity. /// /// An error occurred in the cryptographic message syntax subsystem. ///
public Verify ( MimeKit.Cryptography.SecureMimeContext ctx, MimeEntity &entity ) : DigitalSignatureCollection
ctx MimeKit.Cryptography.SecureMimeContext The S/MIME context to use for verifying the signature.
entity MimeEntity The unencapsulated entity.
return DigitalSignatureCollection