Decrypt Method


Decrypts the encrypted message.


[Visual Basic]

blnResult = ObjectName.Decrypt

 
Parameters: None 
Return value As Boolean True if successful, False if error has occurred and the message was not decrypted.  
Remarks:

To decrypt the message, private key for the certificate which was used to encrypt this message must be available in the certificate storage.

 

If the message is not encrypted nothing happens. To check if the message is encrypted the developer can use the Encrypted property.


Usage example:

' This example loads the encrypted message from file and decrypts it
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 the message
	objSMIME.Decrypt

	' 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:

DecryptAndVerify Method, Encrypted Property


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