Click or drag to resize
MimeKit

ApplicationPkcs7MimeSignAndEncrypt Method (SecureMimeContext, MailboxAddress, DigestAlgorithm, IEnumerableMailboxAddress, MimeEntity)

Cryptographically signs and encrypts the specified entity.

Namespace:  MimeKit.Cryptography
Assembly:  MimeKit (in MimeKit.dll) Version: 2.14.0
Syntax
C#
public static ApplicationPkcs7Mime SignAndEncrypt(
	SecureMimeContext ctx,
	MailboxAddress signer,
	DigestAlgorithm digestAlgo,
	IEnumerable<MailboxAddress> recipients,
	MimeEntity entity
)

Parameters

ctx
Type: MimeKit.CryptographySecureMimeContext
The S/MIME context to use for signing and encrypting.
signer
Type: MimeKitMailboxAddress
The signer.
digestAlgo
Type: MimeKit.CryptographyDigestAlgorithm
The digest algorithm to use for signing.
recipients
Type: System.Collections.GenericIEnumerableMailboxAddress
The recipients.
entity
Type: MimeKitMimeEntity
The entity.

Return Value

Type: ApplicationPkcs7Mime
The signed and encrypted entity.
Exceptions
ExceptionCondition
ArgumentNullException

ctx is null.

-or-

signer is null.

-or-

recipients is null.

-or-

entity is null.

CertificateNotFoundException

A signing certificate could not be found for signer.

-or-

A certificate could not be found for one or more of the recipients.

CmsException An error occurred in the cryptographic message syntax subsystem.
Remarks
Cryptographically signs entity using the supplied signer and then encrypts the result to the specified recipients.
See Also