Decrypt Method
Decrypts the encrypted message.
You can optionally specify the certificate store where to find the certificate suitable for decryption.
[Visual Basic] blnResult = ObjectName.Decrypt([Store], [StoreType], [PfxPassword]) |
Parameters: | ||
Store As String |
(optional) The name of the certificate's storage. The following names are supported for the system storage (REGISTRY_STORE):
When using a file storage (FILE_STORE or FILE_PFX_STORE) this parameter should contain the name of this file storage.
The default value is "MY". |
|
StoreType As Long |
(optional) The type of the certificate's storage. MailBee supports the following types of certificate's storages:
The default value is 0. |
|
PfxPassword As String | (optional) The password which should be used to access the certificates storage if it's a PFX file. The default value is an empty string. | |
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 <> 0) Or (objSMIME.SMIMESpecificError <> 0) 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-2024, AfterLogic Corporation. All rights reserved.