DecryptAndVerify Method


Decrypts the encrypted message and verifies it.


[Visual Basic]

blnResult = ObjectName.DecryptAndVerify

 
Parameters: None 
Return value As Boolean True if successful, False if error has occurred.  
Remarks:

Only signed messages can be decrypted and verified. If the message is not encrypted nothing happens.

 

To check if the message was encrypted or verified the developer can use the Encrypted or Verified properties.


Usage example:

' This example loads the encrypted message from file, decrypts and verifies this message.

Dim objSMIME, objMsg

' Using Visual Basic to create the objects
Set objMsg = CreateObject("MailBee.Message")
Set objSMIME = CreateObject("MailBee.SMIME")

' Using ASP to create the objects
'Set objMsg = Server.CreateObject("MailBee.Message")
'Set objSMIME = Server.CreateObject("MailBee.SMIME")

' Specify MailBee license key
objSMIME.LicenseKey = "put your license key here"

' Load the message from file
objMsg.ImportFromFile "mail_src.eml"

' Specify the message for the further processing
Set objSMIME.Message = objMsg

' Check if the message is encrypted
If objSMIME.Encrypted Then
	' Decrypt and verify the message
	objSMIME.DecryptAndVerify

	' Check if any errors occurred
	If (objSMIME.SMIMEError <> SMIME_OK) Or (objSMIME.SMIMESpecificError <> SMIME_OK) Then
		' Display the code of the last occurred error 
		' In ASP use Response.Write instead of MsgBox
	    MsgBox "SMIMEError = " & objSMIME.SMIMEError & "   SMIMESpecificError = " & _
	      objSMIME.SMIMESpecificError
	End If
End If

See Also:

Decrypt Method, Verify Method


Copyright 2002-2011, AfterLogic Corporation. All rights reserved.