Community articleGetCertificateList function
Added by IBM contributorIBM on July 26, 2013
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

This function locates all available certificates that can be used by a particular signature button. The certificates are filtered according to the signature engine defined in the signformat option of the button, and according to the filters defined in the signdetails option of the button.
This function returns the valid certificates in an undetermined order. This means that you cannot rely on the certificates being listed in the same order each time you call this function.

Function

   Function GetCertificateList(
      theFilters As String, 
      theStatus As Long
      ) As CertificateList


Parameters

Table 1. Function parameters
ExpressionTypeDescription
theFiltersStringA string that is used to filter the subject attribute of the certificate. If the subject attribute include this substring, then that certificate will be listed.
For example, you might filter against a name, such as "John Doe", or an e-mail address, such as "jdoe@ibm.com".
Note that this filter is in addition to the other filters defined in the signdetails option of the button.
If null is passed, then only the filters in the signdetails option are used.
theStatusLongThis is a status flag that reports whether the operation was successful. Possible values are:
SUSTATUS_OK — the operation was successful.
SUSTATUS_CANCELLED — the operation was cancelled by the user.
SUSTATUS_INPUT_REQUIRED — the operation required user input, but could not receive it (for example, it was run on a server with no user).


Returns

An array containing the list of certificates objects.

Example

The following function uses DereferenceEx to locate a signature button in the form. It then calls GetCertificateList to get a list of valid certificates for that button. The function then loops through the available certificates, using GetDataByPath to check the common name of each certificate. When it finds the certificate with the common name of "TJones", it calls SignForm and uses that certificate to sign the form.
   Sub ApplySignature(Form)
 
      Dim SigNode, SigObject  ' objects
      Dim TheCerts  ' CertificateList
      Dim CommonName  ' String
      Dim Cert  ' ICertificate
 
      ' Get the SignatureButton node
 
      Set SigNode = Form.DereferenceEx(vbNullString, _
         "PAGE1.SignatureButton", 0, UFL_ITEM_REFERENCE, Nothing)
 
      ' Get available certificates for that button
 
      Set TheCerts = SigNode.GetCertificateList(vbNullString, 1) 'vbNull
 
      ' Test each of the available certificates to see if it has a common
      ' name of "TJones".  If it does, use that certificate to sign
      ' the form.
 
      For Each Cert in TheCerts
         CommonName = Cert.GetDataByPath("SigningCert: Subject: CN", _
            False, 1) ' vbNull
         If CommonName = "TJones" Then
            Set SigObject = SigNode.SignForm(TheCerts(1), Nothing, 1) 
               ' vbNull
         End If
      Next
 
   End Sub


Parent topic:
FormNodeP functions