ICEnroll3::GetKeyLen method (xenroll.h)

[This method is no longer available for use as of Windows Server 2008 and Windows Vista.]

The GetKeyLen method retrieves the minimum and maximum key lengths for the signature and exchange keys. This method was first defined in the ICEnroll3 interface. The values retrieved by this method are dependent upon the current cryptographic service provider.

Syntax

HRESULT GetKeyLen(
  [in]  BOOL fMin,
  [in]  BOOL fExchange,
  [out] LONG *pdwKeySize
);

Parameters

[in] fMin

Boolean value indicating which key length (minimum or maximum) is retrieved. If fMin is TRUE, the minimum key length is retrieved; if it is FALSE, the maximum key length is retrieved.

[in] fExchange

Boolean value indicating the type of key. If fExchange is TRUE, the exchange key length is retrieved; if it is FALSE, the signature key length is retrieved.

[out] pdwKeySize

Pointer that receives the key's minimum or maximum length, in bits.

Return value

C++

If the method succeeds, the method returns S_OK, and *pdwKeySize will be the value representing the length (in bits) for the key's minimum or maximum length.

If the method fails, it returns an HRESULT value that indicates the error. For a list of common error codes, see Common HRESULT Values.

VB

A value that represents the length, in bits, for the key's minimum or maximum length.

Remarks

Call this method to determine the minimum and maximum key lengths. If a CSP does not support this method, an error is returned.

Examples

DWORD dwExchMin, dwExchMax, dwSignMin, dwSignMax;

// Determine the minimum and maximum key length values.
// hr is HRESULT variable.
hr = pEnroll->GetKeyLen( TRUE, TRUE, &dwExchMin );
if ( FAILED( hr ) )    
    printf("Failed GetKeyLen for Exchange Minimum [%x]\n", hr);
else
    printf("Exchange key Min: %d\n", dwExchMin);

hr = pEnroll->GetKeyLen( FALSE, TRUE, &dwExchMax );
if ( FAILED( hr ) )
    printf("Failed GetKeyLen for Exchange Maximum [%x]\n", hr);
else
    printf("Exchange key Max: %d\n", dwExchMax );

hr = pEnroll->GetKeyLen( TRUE, FALSE, &dwSignMin );
if ( FAILED( hr ) )
    printf("Failed GetKeyLen for Signature Minimum [%x]\n", hr);
else
    printf("Signature key Min: %d\n", dwSignMin );

hr = pEnroll->GetKeyLen( FALSE, FALSE, &dwSignMax );
if ( FAILED( hr ) )    
    printf("Failed GetKeyLen for Signature Maximum [%x]\n", hr);
else
    printf("Signature key Max: %d\n", dwSignMax );

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header xenroll.h
Library Uuid.lib
DLL Xenroll.dll

See also

CEnroll

ICEnroll3

ICEnroll4