SmimeSignAndEncrypt Method (MailMessage, Certificate, CertificateCollection, CertificateCollection) |
Signs and encrypts an e-mail message, with the ability to provide a user-defined chain of signing certificates.
Namespace: MailBee.SecurityAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax public MailMessage SignAndEncrypt(
MailMessage message,
Certificate signingCert,
CertificateCollection extraSigningCerts,
CertificateCollection encryptionCerts
)
Public Function SignAndEncrypt (
message As MailMessage,
signingCert As Certificate,
extraSigningCerts As CertificateCollection,
encryptionCerts As CertificateCollection
) As MailMessage
Parameters
- message
- Type: MailBee.MimeMailMessage
The original e-mail message to be signed and encrypted. - signingCert
- Type: MailBee.SecurityCertificate
The certificate to be used for signing the message. This certificate must contain a private key. - extraSigningCerts
- Type: MailBee.SecurityCertificateCollection
The additional certificates in the chain of the signing certificate. If a null reference (Nothing in Visual Basic), MailBee will build the certificate chain from the signing certificate to the root authority automatically. - encryptionCerts
- Type: MailBee.SecurityCertificateCollection
The collection of public certificates of all the recipients of the message.
Return Value
Type:
MailMessageA reference to the signed and encrypted message if the signing and encryption went successfully; a reference to the original message if it was already signed and encrypted;
a null reference (
Nothing in Visual Basic) if the signing or encryption failed.
Exceptions Remarks This is a special overload which makes it possible to sign e-mail messages with certificate whose root authority certificate is not present in the system store.
In this case, extraSigningCerts collection must contain all certificates signingCert derives from (such as root authority and CA certificates).
Examples See Also