Verifies the digital signature of the email. This method is obsoleted, use VerifyMessageSignature method instead.
[Visual Basic] Public Function VerifySignature( _ ) As Certitifcate
[C#] public Certitifcate VerifySignature( );
[C++] public: Certitifcate^ VerifySignature( );
[JScript] public function VerifySignature( ) : Certitifcate;
Return Value
Example
[Visual Basic, C#, C++] The following example demonstrates how to verify signed email and decrypt encrypted email with EAGetMail POP3 & IMAP4 Component. To get the full samples of EAGetMail, please refer to Samples section.
[VB - Verify and Decrypt Email]
Dim oMail As New Mail("TryIt")
oMail.Load("c:\test.eml, False)
If (oMail.IsEncrypted) Then
Try
' this email is encrypted, we decrypt it by user default certificate.
' you can also use specified certificate like this
' Dim oCert As New Certificate()
' oCert.Load("c:\test.pfx", "pfxpassword", Certificate.CertificateKeyLocation.CRYPT_USER_KEYSET)
' oMail = oMail.Decrypt(oCert)
oMail = oMail.Decrypt(Nothing)
Catch ep As Exception
MessageBox.Show(ep.Message)
End Try
End If
If (oMail.IsSigned) Then
Try
' this email is digital signed.
Dim cert As EAGetMail.Certificate = oMail.VerifySignature()
MessageBox.Show("This email contains a valid digital signature.")
' you can add the certificate to your certificate storage like this
' cert.AddToStore(Certificate.CertificateStoreLocation.CERT_SYSTEM_STORE_CURRENT_USER,"addressbook");
' then you can use send the encrypted email back to this sender.
Catch ep As Exception
MessageBox.Show(ep.Message)
End Try
End If
[C# - Verify and Decrypt Email]
Mail oMail = new Mail("TryIt");
oMail.Load("c:\\test.eml", false);
if(oMail.IsEncrypted)
{
try
{
// this email is encrypted, we decrypt it by user default certificate.
// you can also use specified certificate like this
// Certificate oCert = new Certificate();
// oCert.Load("c:\test.pfx", "pfxpassword", Certificate.CertificateKeyLocation.CRYPT_USER_KEYSET)
// oMail = oMail.Decrypt(oCert);
oMail = oMail.Decrypt(null);
}
catch(Exception ep)
{
MessageBox.Show(ep.Message);
}
}
if(oMail.IsSigned)
{
try
{
// this email is digital signed.
EAGetMail.Certificate cert = oMail.VerifySignature();
MessageBox.Show("This email contains a valid digital signature.");
// you can add the certificate to your certificate storage like this
// cert.AddToStore(Certificate.CertificateStoreLocation.CERT_SYSTEM_STORE_CURRENT_USER,
// "addressbook");
// then you can use send the encrypted email back to this sender.
}
catch(Exception ep)
{
MessageBox.Show(ep.Message);
}
}
Remarks
See Also
Mail.IsEncrypted Property
Mail.IsSigned Property
Mail.Decrypt Method
Online Tutorials
Verify Digital Signature and Decrypt Email in C# - Tutorial
Verify Digital Signature and Decrypt Email in VB.NET - Tutorial
Verify Digital Signature and Decrypt Email in C++/CLI - Tutorial