| Platform SDK: Certificate Enrollment Control |
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);
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.
// 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");
' 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
Windows NT/2000: Requires Windows 2000.
Header: Declared in Xenroll.h.
Library: Use Uuid.lib.