Platform SDK: Smart Card Enrollment Control

ISCrdEnr::enumCAName

The enumCAName method enumerates the names of the certification authorities (CAs) for a given certificate template name.

objSCEnroll.enumCAName( _
    dwIndex As Long, _
    dwFlags As Long, _
    bstrCertTemplateName As String ) As String

Parameters

objSCEnroll
Object expression that resolves to a SCrdEnr object.
dwIndex
Zero-based index for the enumeration sequence.
dwFlags
Value that specifies whether the name refers to the CA name or the CA's machine name. If this value is SCARD_ENROLL_CA_MACHINE_NAME (defined as 0x01), the name refers to the CA's machine name. Otherwise the name refers to the CA name.
bstrCertTemplateName
Name of the certificate template.

Return Values

String representing the name of the CA.

Example Code in VBScript

' Define the constants.
Const SCARD_ENROLL_CA_MACHINE_NAME = 1

Dim  strCTName, strMachine, strFullCAName
Dim  nCount, nIndex

' Specify the certificate template name.
strCTName = "User"

' Retrieve the number of available CAs.
nCount = Senroll.getCACount( strCTName )
If ( 0 = nCount ) Then
    MsgBox("No CAs available for the specified certificate template.")
Else
    ' Display each CA name in a message box.
    For nIndex = 0 to nCount - 1
        strFullCAName = Senroll.enumCAName( nIndex, _
                        SCARD_ENROLL_CA_MACHINE_NAME, _
                        strCTName)
        strFullCAName = strFullCAName & "\"
        strFullCAName = strFullCAName & _
                        Senroll.enumCAName( nIndex, _
                        0, _
                        strCTName)
        MsgBox( strFullCAName )
    Next
End If 

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Unsupported.
  Library: Included as a resource in Scrdenrl.dll.

See Also

ISCrdEnr::getCACount, ISCrdEnr::getCAName, ISCrdEnr::setCAName