Skip to content

Latest commit

 

History

History
72 lines (51 loc) · 1.76 KB

CryptAcquireContext.md

File metadata and controls

72 lines (51 loc) · 1.76 KB

Home

Function name : CryptAcquireContext

Group: Cryptography Reference - Library: advapi32


The CryptAcquireContext function is used to acquire a handle to a particular key container within a particular cryptographic service provider (CSP). This returned handle is used in calls to CryptoAPI functions that use the selected CSP.


Code examples:

How to fill a buffer with random bytes using Cryptography API Functions
CryptoAPI: Collection of Providers class
How to create MD-5 and SHA-1 hash values from a string
A class that encrypts and decrypts files using Cryptography API Functions
Generating random cryptographic keys

Declaration:

BOOL WINAPI CryptAcquireContext(
  HCRYPTPROV* phProv,
  LPCTSTR pszContainer,
  LPCTSTR pszProvider,
  DWORD dwProvType,
  DWORD dwFlags
);  

FoxPro declaration:

DECLARE INTEGER CryptAcquireContext IN advapi32;
	INTEGER @ hProvHandle,;
	STRING    cContainer, ;
	STRING    cProvider,;
	INTEGER   nProvType,;
	INTEGER   nFlags
  

Parameters:

phProv [out] Pointer to a handle of a CSP.

pszContainer [in] Key container name.

pszProvider [in] A null-terminated string that specifies the name of the CSP to be used.

dwProvType [in] Specifies the type of provider to acquire.

dwFlags [in] Flag values.


Return value:

If the function succeeds, the function returns nonzero (TRUE).


Comments:

When you have finished using the CSP, release the handle by calling the CryptReleaseContext function.