IEnroll::get_GenKeyFlags method (xenroll.h)

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

The GenKeyFlags property sets or retrieves the values passed to CryptGenKey when the certificate request is generated.

By default, the GenKeyFlags property is set to zero. However, when a .pvk file is specified, the value of GenKeyFlags defaults to CRYPT_EXPORTABLE. For more information, see Remarks.

This property was first defined in the IEnroll interface.

This property is read/write.


HRESULT get_GenKeyFlags(
  LONG *pdwFlags



Return value



By default, private keys are not exportable unless a .pvk file is requested. To make the private key exportable without specifying a .pvk file, set GenKeyFlags to CRYPT_EXPORTABLE.

To specify a .pvk file name, use the PVKFileNameWStr property.

The GenKeyFlags property value is passed to the CryptGenKey CryptoAPI function by using its dwFlags parameter.

If the cryptographic service provider (CSP) does not support exportable private keys, an error occurs.

The GenKeyFlags property affects the behavior of the following methods:

Note  The default value for the GenKeyFlags property is zero. If you need to change this value, you must do so before calling these methods. After calling any of these methods, you cannot change the GenKeyFlags property 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