IEnroll4::GenKeyFlags property

[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 put_GenKeyFlags(
  [in]  LONG Flags

HRESULT get_GenKeyFlags(
  [out] LONG *pFlags

Property value

LONG value assigned to the GenKeyFlags property.

Error codes

If the property access methods put_GenKeyFlags and get_GenKeyFlags succeed, they return S_OK.

Any other HRESULT value indicates that the call failed.


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]

End of client support

Windows XP

End of server support

Windows Server 2003








IID_IEnroll4 is defined as f8053fe5-78f4-448f-a0db-41d61b73446b

See also