SelectSenderCert Method
Specifies the certificate to be used to sign
a new message.
To sign a new message, the developer must specify a certificate with this method,
and then call the Sign
method.
|
[Visual Basic] blnResult = ObjectName.SelectSenderCert([Path], [StoreType], IssuedTo, IssuedBy, FriendlyName, Password) |
||
| Parameters: | ||
| Path 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.
By default, this parameter is set to "MY" value. |
|
| StoreType As Long |
(optional) The type of the certificate's storage. MailBee supports the following types of certificate's storages:
By default, this parameter is set to REGISTRY_STORE value. |
|
| IssuedTo As String | The name of a person or organization to whom the certificate was issued. | |
| IssuedBy As String | The name of a person or organization by whom the certificate was issued. | |
| FriendlyName As String | The friendly name of a person to whom the certificate was issued. | |
| Password As String | The password which should be used to access the certificates storage. The password is usually used only for PFX storages. If the password is not used, this parameter should contain an empty string. | |
| Return value As Boolean | True if successful, False if error has occurred. | |
Usage example:
' This example loads 5 messages from files, encrypts them and save them to disk using only one instance of the SMIME object. 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" ' Iterate through the messages For i = 1 To 5 ' Load the message from file objMsg.ImportFromFile "mail_src" & i & ".eml" ' Specify the message for the further processing Set objSMIME.Message = objMsg ' Select the sender's certificate from the system storage of the current user If objSMIME.SelectSenderCert ("MY", 0, "Thawte Freemail Member", "", "", "") Then ' Sign the message objSMIME.Sign End If ' 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 ' Get the signed message from SMIME object
Set objMsg = objSMIME.Message ' Save the signed message to disk objMsg.SaveMessage "mail_dst" & i & ".eml" ' Reset the SMIME object objSMIME.Reset Next
See Also:
AddRecipientCert Method, Sign Method
Copyright 2002-2011, AfterLogic Corporation. All rights reserved.