Click or drag to resize
MimeKit

ApplicationPkcs7MimeSignAndEncrypt Method (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(
	MailboxAddress signer,
	DigestAlgorithm digestAlgo,
	IEnumerable<MailboxAddress> recipients,
	MimeEntity entity
)

Parameters

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

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 the default SecureMimeContext and then encrypts the result to the specified recipients.
See Also