SelectSignerCertStore Method


Specifies the certificate storage where to save the certificate of the entity which signed the message being currently processed.

To add a signer's certificate to the store, set the store with SelectSignerCertStore method, and then call AddSignerToStore method.

 

For instance, the user (message recipient) had received the message which was signed and encrypted by another user (the original sender and signer of this message). If the recipients would like to be able to send the reply-messages encrypted with the original sender's certificates, they should add the original sender's certificate to the certificates storage (using the SelectSignerCertStore and AddSignerToStore methods).

 

Note that SelectSignerCertStore, when used with AddSignerToStore to save the certicate into a file, can only produce .p7b (not .cer) files.

 

Once the certificate was successfully added to the storage, user can encrypt the reply-message with the public key contained in this certificate (using AddRecipientCert and Encrypt methods).


[Visual Basic]

blnResult = ObjectName.SelectSignerCertStore([Path], [StoreType])

 
Parameters:  
Path As String

(optional) The name of the certificate's storage. The following names are supported for the system storage (REGISTRY_STORE):

  • MY - the personal user's certificates storage
  • AddressBook - other people certificates storage
  • CA - Intermediate Certification Authorities
  • Root - Trusted Root Certification Authorities

When using the 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 "AddressBook" value.

 
StoreType As Long

(optional) The type of the certificate's storage. MailBee supports the following types of certificate's storages:

  • REGISTRY_STORE = 0 - standart system storage which belongs to the current user
  • FILE_STORE = 1 - file storage
  • FILE_PFX_STORE = 2 - file PFX storage (special file type)

By default, this parameter is set to REGISTRY_STORE value.

 
Return value As Boolean True if successful, False if error has occurred.  

Usage example:

' This example loads the message from file and adds the recipient's certificate to the system storage of the current user.

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 signed and select the system storage of the current user
If objSMIME.Signed And (objSMIME.SelectSignerCertStore ("MY", REGISTRY_STORE)) Then
	' Add the signer's certificate to the system storage of the current user
	objSMIME.AddSignerToStore

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

AddSignerToStore Method, AddRecipientCert Method, Encrypt Method


Copyright © 2002-2022, AfterLogic Corporation. All rights reserved.