AllAPI Network - The KPD-Team

 
Allapi Network
 API-Guide
 ApiViewer

 API List

 
API Resources
 Tips & Tricks
 VB Tutorials
 Error Lookup
 
Misc Stuff
 VB examples
 VB Tools
 VB Links
 Top Downloads
 
This Site
 Search Engine
 Contact Form
 

Donate to AllAPI.net

CryptGetUserKey

The CryptGetUserKey function retrieves a handle to a permanent user key pair, such as the user’s signature key pair.

VB4-32,5,6
Declare Function CryptGetUserKey Lib "advapi32.dll" (ByVal hProv As Long, ByVal dwKeySpec As Long, phUserKey As Long) As Long

VB.NET
System.Security.Cryptography.*

Operating Systems Supported
Windows NT 4.0 or later; Windows 95 OSR2 or later (or Windows 95 with Internet Explorer 3.02 or later)

Library
Advapi32

Parameter Information
· hProv
[in] A handle to the application’s CSP. An application obtains this handle using the CryptAcquireContext function.

· dwKeySpec
[in] The specification of the key to retrieve. The following keys are retrievable from almost all providers:
· AT_KEYEXCHANGE ¾ Exchange public key
· AT_SIGNATURE ¾ Signature public key
Additionally, some providers allow access to other user specific keys through this function. See the documentation on the specific provider for details.

· phUserKey
[out] The address that the function copies the handle of the retrieved key to.

Return Values
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To retrieve extended error information, use the GetLastError function.

The following table lists the error codes most commonly returned by the GetLastError function. The error codes prefaced by “NTE” are generated by the particular CSP you are using.
ERROR_INVALID_HANDLE
One of the parameters specifies an invalid handle.

ERROR_INVALID_PARAMETER
One of the parameters contains an invalid value. This is most often an illegal pointer.

NTE_BAD_KEY
The dwKeySpec parameter contains an invalid value.

NTE_BAD_UID
The hProv parameter does not contain a valid context handle.

NTE_NO_KEY
The key requested by the dwKeySpec parameter does not exist.

Examples

Related Functions

No VB.NET Example Found

 

 


Copyright © 1998-2007, The Mentalis.org Team - Privacy statement
Did you find a bug on this page? Tell us!
This site is located at http://allapi.mentalis.org/