Platform SDK: Certificate Enrollment Control

ICEnroll3::ReuseHardwareKeyIfUnableToGenNew [C++]

CEnroll.ReuseHardwareKeyIfUnableToGenNew [Visual Basic]

The ReuseHardwareKeyIfUnableToGenNew property determines the action taken by the ICEnroll3 object if an error is encountered when generating a new key. This property is read-write. The default value is TRUE.

[Visual Basic]
objEnroll.ReuseHardwareKeyIfUnableToGenNew [ = bValue ]
[C++]
HRESULT put_ReuseHardwareKeyIfUnableToGenNew(BOOL bValue);
HRESULT get_ReuseHardwareKeyIfUnableToGenNew(BOOL * pbValue);

Parameters

[Visual Basic] objEnroll
Object expression that resolves to a CEnroll object.
[Visual Basic,C++] bValue
A Boolean value assigned to this property. It is one of the following values:
[C++] pbValue
Pointer to retrieved property value.

Remarks

This property is a Boolean value. This property affects only cryptographic service providers that return NTE_TOKEN_KEYSET_STORAGE_FULL. These CSPs are typically hardware-based; an example is a smart card. If this property is TRUE and an error is encountered while generating a new key, the ICEnroll3 control will reuse the existing hardware key. If this property is FALSE and an error is encountered while generating a new key, the ICEnroll3 control will not reuse the existing hardware key but will instead pass an error to the caller.

Example Code [C++]

// Code to set the reuse H/W key status.
// hr is HRESULT variable.
hr = pEnroll->put_ReuseHardwareKeyIfUnableToGenNew( FALSE );
if ( FAILED( hr ) )    
    printf("Failed put_ReuseHardwareKeyIfUnableToGenNew [%x]\n", hr);


// Code to retrieve the reuse H/W key status.
BOOL bReuse;

hr = pEnroll->get_ReuseHardwareKeyIfUnableToGenNew( &bReuse );
if ( FAILED( hr ) )
    printf("Failed get_ReuseHardwareKeyIfUnableToGenNew [%x]\n", hr);
else
    printf("Hardware key %s be reused if unable"
           " to generate a new key.\n", bReuse ? "will" : "will not");

Example Code [Visual Basic]

' Variable for the CEnroll object.
Dim objXen As Object

' Instantiate the object.
Set objXen = CreateObject("CEnroll.CEnroll.1")

Dim bReuse As Boolean

bReuse = objXen.ReuseHardwareKeyIfUnableToGenNew

If (True = bReuse) Then
    MsgBox ("H/W key will be re-used if a new one isn't creatable.")
Else
    MsgBox ("H/W key will not be re-used if a new one isn't creatable.")
End If

' Free object resource.
Set objXen = Nothing

Requirements

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

See Also

ICEnroll3