Platform SDK: Cryptography |
The CPGetUserKey function retrieves the handle of one of the permanent key pairs in the hProv key container.
BOOL CPGetUserKey( HCRYPTPROV hProv, // in DWORD dwKeySpec, // in HCRYPTKEY *phUserKey // out );
Key pair type | Descriptipn |
---|---|
AT_KEYEXCHANGE | Key used to encrypt and exchange session keys. |
AT_SIGNATURE | Keys used to create and verify digital signatues. |
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE, and the appropriate error code from the following table must be set using SetLastError.
Error | Description |
---|---|
NTE_BAD_KEY | The key specified by the hKey parameter is invalid. |
NTE_BAD_UID | The CSP context that was specified when the key was created cannot now be found. |
NTE_NO_KEY | The key specified by the dwKeySpec parameter does not exist. |
Windows NT/2000: Requires Windows NT 4.0 or later.
Windows 95/98: Requires Windows 95 OSR2 or later (or Windows 95 with Internet Explorer 3.02 or later).
Header: Declared in Wincrypt.h.