Platform SDK: Certificate Enrollment Control

ICEnroll3::HashAlgID [C++]

CEnroll.HashAlgID [Visual Basic]

The HashAlgID property specifies the hash algorithm to be used when signing the PKCS #10.

[Visual Basic]
objEnroll.HashAlgID [ = hashAlgID]
[C++]
HRESULT put_HashAlgID( DWORD hashAlgID);
HRESULT get_HashAlgID( DWORD* hashAlgID);

Parameters

[Visual Basic] objEnroll
Object expression that resolves to a CEnroll object.
[Visual Basic,C++] hashAlgID
Value representing the ID of a hash algorithm. The datatype is a DWORD in C++ and a Long in Visual Basic.

Remarks

The values for this property are hash algorithm IDs, such as those returned by the ICEnroll3::EnumAlgs method. If both the HashAlgID and HashAlgorithm properties are set, whichever is last updated will specify which hash algorithm will be used to sign the PKCS #10.

Example Code [C++]

// Code to set the hash algorithm ID.
// hr is HRESULT variable.
hr = pEnroll->put_HashAlgID( CALG_MD4 );
if ( FAILED( hr ) )    
    printf("Failed put_HashAlgID [%x]\n", hr);


// Code to retrieve the hash algorithm ID.
DWORD dwHashID;

hr = pEnroll->get_HashAlgID( &dwHashID );
if ( FAILED( hr ) )    
    printf("Failed get_HashAlgID [%x]\n", hr);
else
    printf("HashAlgID: %d\n", dwHashID);
 

Example Code [Visual Basic]

' Constant for CALG_MD4 (from wincrypt.h).
Const CALG_MD4 = 32770

' Set the hash algorithm ID.
objXen.HashAlgID = CALG_MD4

Requirements

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

See Also

ICEnroll::HashAlgorithm, ICEnroll3::EnumAlgs