Platform SDK: Certificate Enrollment Control

ICEnroll3::GetAlgName [C++]

CEnroll.GetAlgName [Visual Basic]

The GetAlgName method retrieves the name of a cryptographic algorithm given its ID. This is useful for displaying names of algorithms whose IDs are retrieved by calling ICEnroll3::EnumAlgs. The values retrieved by this method are dependent upon the current cryptographic service provider.

[Visual Basic]
objEnroll.GetAlgName( _
            algID As Long ) As String
[C++]
HRESULT GetAlgName(
  DWORD  algID,
  BSTR*  pbstr
);

Parameters

[Visual Basic] objEnroll
Object expression that resolves to a CEnroll object.
[Visual Basic,C++] algID
Value representing a cryptographic algorithm, as defined in wincrypt.h. For example, CALG_MD2 is a defined algorithm identifier. For this method to be successful, the current cryptographic service provider must support the algID algorithm.
[C++] pbstr
Upon success, pointer to a BSTR representing the name of the algorithm specified by algID. It is the caller's responsibility to free the memory used by pbstr (by means of SysFreeString).

Return Values

[Visual Basic] The return value is a string representing the name of the algorithm specified by algID. If a CSP doesn't support this method, an error is returned.

[C++] The return value is an HRESULT. A value of S_OK indicates success. If a CSP doesn't support this method, an error is returned.

Remarks

Call this method to retrieve a string representing the name of a cryptographic algorithm, given its ID.

Example Code [C++]

BSTR      bstrAlgName = NULL;

HRESULT   hr;

// Retrieve the algorithm name.
// dwAlgID is a DWORD variable for an algorithm ID.
hr = pEnroll->GetAlgName( dwAlgID, &bstrAlgName);
if (FAILED(hr))
    printf("Failed GetAlgName [%x]\n", hr);
else
    printf("AlgID: %d Name: %S\n", dwAlgID, bstrAlgName );

// Free BSTR resource.
if ( NULL != bstrAlgName )
{
    SysFreeString( bstrAlgName );
    bstrAlgName = NULL;
}

Example Code [Visual Basic]

Dim strAlgName As String

' Retrieve the name.
' AlgID is a LONG value representing an algorithm ID.
strAlgName = objXen.GetAlgName(AlgID)

' Display the name.
MsgBox(strAlgName)

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Xenroll.h.
  Library: Use Uuid.lib.

See Also

ICEnroll3::EnumAlgs