Cryptographic Functions

These low-level Win32® cryptographic functions were formerly in Microsoft® CryptoAPI version 1.0, and provide you the most flexibility in applying cryptography to your applications. These functions facilitate communication with the cryptographic service providers (CSP).

The following functions are included in this category and can also be found in Wincrypt.h.

Function Description
CryptAcquireContext Acquires a handle to a particular key container within a particular CSP.
CryptContextAddRef Adds one to the reference count on a HCRYPTPROV handle.
CryptCreateHash Initiates the hashing of a stream of data.
CryptDecrypt Decrypts data that was previously encrypted via the CryptEncrypt function.
CryptDeriveKey Generates cryptographic keys derived from base data.
CryptDestroyHash Destroys the hash object referenced by the hHash parameter.
CryptDestroyKey Releases the handle referenced by the hKey parameter. After a key handle has been released, it becomes invalid and cannot be used again.
CryptDuplicateHash Makes an exact copy of a hash and the state the hash is in.
CryptDuplicateKey Makes an exact copy of a key and the state the key is in.
CryptEncrypt Encrypts data.
CryptEnumProviders Enumerates the providers on a computer.
CryptEnumProviderTypes Enumerates the types of providers supported on the computer.
CryptExportKey Exports cryptographic keys out of a cryptographic service provider in a secure manner.
CryptFormatObject Formats the encoded data and returns a Unicode string in the allocated buffer according to the certificate encoding type.
CryptGenKey Generates random cryptographic keys for use with the CSP module.
CryptGenRandom Fills a buffer with random bytes.
CryptGetDefaultProvider Determines the default CSP either for the current user or the computer for a given provider type.
CryptGetHashParam Retrieves data that governs the operations of a hash object.
CryptGetKeyParam Retrieves data that governs the operations of a key.
CryptGetProvParam Retrieves parameters that govern the operations of a CSP.
CryptGetUserKey Retrieves a handle to a permanent user key pair, such as the user's signature key pair.
CryptHashData Computes the cryptographic hash on a stream of data.
CryptHashSessionKey Computes the cryptographic hash on a key object.
CryptImportKey Transfers a cryptographic key from a key blob to a CSP.
CryptProtectData Performs encryption on the data in a DATA_BLOB.
CryptQueryObject Takes a CERT_BLOB or a file name and returns the information about the content of the blob or the file.
CryptReleaseContext Releases a handle to a CSP and a key container.
CryptSetHashParam In theory, this function customizes the operations of a hash object. Currently, only a single parameter is defined for this function.
CryptSetKeyParam Customizes various aspects of a key's operations.
CryptSetProvider Specifies the current user default CSP.
CryptSetProviderEx Specifies either the current user default CSP or the computer default CSP.
CryptSetProvParam Customizes the operations of a CSP.
CryptSignHash Signs a piece of data.
CryptUnprotectData Performs a decryption and integrity check of the data in a DATA_BLOB.
CryptVerifySignature Verifies a signature against a hash object.