SmimeDecryptAndVerify2 Method |
Namespace: MailBee.Security
public SmimeResult DecryptAndVerify2( MailMessage message, MessageVerificationFlags flags, X509Certificate2Collection extraCertsForDecrypt, X509Certificate2Collection extraCertsForVerify )
Exception | Condition |
---|---|
MailBeeInvalidArgumentException | message is a null reference (Nothing in Visual Basic). |
MailBeeCertificateException | A cryptographic error occurred and ThrowExceptions is true. Typically, if the error message is "Keyset does not exist", indicates that there is no private key in the certicate required for decryption. |
The returned SmimeResult object provides access to the return values of this method, including DecryptedMessage, DecryptionCertificate, VerificationResult, and SignatureCertificate.
Thus, to access the decrypted message, use DecryptedMessage property; to get the certificate used for decryption, use DecryptionCertificate property.
To check the result of the message signature verification, examine VerificationResult property value. To access the signature certificate, use SignatureCertificate property.
See Decrypt(MailMessage) and Verify(MailMessage, MessageVerificationFlags, CertificateStore) topics for more details on decryption and verification process.
This method is a version of DecryptAndVerify(MailMessage, MessageVerificationFlags, CertificateStore, CertificateStore) which accepts X509Certificate2Collection rather than CertificateStore. Starting from .NET Standard 2.0, you must use this method as CertificateStore functionality has been reduced to avoid dependency on Win32 API.
Note |
---|
This method is not available in .NET Сore 1.0/1.1. On that platform, use DecryptAndVerify(MailMessage, MessageVerificationFlags, CertificateStore, CertificateStore) instead. |