Platform SDK: Certificate Enrollment Control

ICEnroll::KeySpec [C++]

CEnroll.KeySpec [Visual Basic]

The KeySpec property is used to specify the key type to be generated. For the Microsoft Base Cryptographic Provider, this will have a value of AT_KEYEXCHANGE for exchange keys, or AT_SIGNATURE for signature keys. However, this parameter is specific to the provider used and may be any value that makes sense to the provider. The default for Microsoft Base Cryptographic Provider is AT_SIGNATURE. For information on the other Microsoft Cryptographic Service Providers, see Cryptographic Service Providers in the CryptoAPI 2.0 documentation.

[Visual Basic]
objEnroll.KeySpec [ = Spec ]
[C++]
HRESULT put_KeySpec(DWORD Spec);
HRESULT get_KeySpec(DWORD * pSpec);

Parameters

[Visual Basic] objEnroll
Object expression that resolves to a CEnroll object.
[Visual Basic,C++] Spec
Value assigned to the KeySpec property. The datatype is a DWORD in C++, and a Long in Visual Basic. The value of this property depends on the provider. See your cryptographic service provider (CSP) for details.
[C++] pSpec
Pointer to retrieved property value.

Remarks

KeySpec affects the behavior of the following methods:

Example Code [C++]

DWORD    dwKeySpec;
HRESULT  hr;

// pEnroll is previously instantiated ICEnroll interface pointer

// get the KeySpec value
hr = pEnroll->get_KeySpec( &dwKeySpec );
if (FAILED( hr ))
    printf("Failed get_KeySpec - %x\n", hr );
else
    printf( "KeySpec: %d\n", dwKeySpec );

// set the KeySpec value
hr = pEnroll->put_KeySpec( AT_KEYEXCHANGE );
if (FAILED( hr ))
    printf("Failed put_KeySpec - %x\n", hr );
else
    printf( "KeySpec set to %d\n", AT_KEYEXCHANGE ); 

Example Code [Visual Basic]

Const AT_KEYEXCHANGE As Long = 1
      
' declare Certificate Enrollment Control object
Dim objXen As Object

Dim nKeySpec As Long

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

' retrieve and display the KeySpec
nKeySpec = objXen.KeySpec
MsgBox nKeySpec, vbOKOnly, "KeySpec"

' set the KeySpec
objXen.KeySpec = AT_KEYEXCHANGE

Requirements

  Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with the Windows NT 4.0 Option Pack).
  Header: Declared in Xenroll.h.
  Library: Use Uuid.lib.