Skip to content

Latest commit

 

History

History
163 lines (122 loc) · 7.07 KB

nf-wincrypt-crypthashpublickeyinfo.md

File metadata and controls

163 lines (122 loc) · 7.07 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:wincrypt.CryptHashPublicKeyInfo
CryptHashPublicKeyInfo function (wincrypt.h)
Encodes the public key information in a CERT_PUBLIC_KEY_INFO structure and computes the hash of the encoded bytes.
CryptHashPublicKeyInfo
CryptHashPublicKeyInfo function [Security]
_crypto2_crypthashpublickeyinfo
security.crypthashpublickeyinfo
wincrypt/CryptHashPublicKeyInfo
security\crypthashpublickeyinfo.htm
security
b0c419b7-ebb3-42c6-9f6a-59b55a2db1b2
12/05/2018
CryptHashPublicKeyInfo, CryptHashPublicKeyInfo function [Security], _crypto2_crypthashpublickeyinfo, security.crypthashpublickeyinfo, wincrypt/CryptHashPublicKeyInfo
wincrypt.h
Windows
Windows XP [desktop apps \| UWP apps]
Windows Server 2003 [desktop apps \| UWP apps]
Crypt32.lib
Crypt32.dll
Windows
19H1
CryptHashPublicKeyInfo
wincrypt/CryptHashPublicKeyInfo
c++
APIRef
kbSyntax
DllExport
Crypt32.dll
CryptHashPublicKeyInfo

CryptHashPublicKeyInfo function

-description

Important  This API is deprecated. New and existing software should start using Cryptography Next Generation APIs. Microsoft may remove this API in future releases.
 
The CryptHashPublicKeyInfo function encodes the public key information in a CERT_PUBLIC_KEY_INFO structure and computes the hash of the encoded bytes. The hash created is used with key identifier functions.

-parameters

-param hCryptProv [in]

This parameter is not used and should be set to NULL.

Windows Server 2003 and Windows XP:  A handle of the cryptographic service provider (CSP) to use to compute the hash.This parameter's data type is HCRYPTPROV.

Unless there is a strong reason for passing in a specific cryptographic provider in hCryptProv, zero is passed in. Passing in zero causes the default RSA or Digital Signature Standard (DSS) provider to be acquired before doing hash, signature verification, or recipient encryption operations.

-param Algid [in]

An ALG_ID structure that specifies the CryptoAPI hash algorithm to use. If Algid is zero, the default hash algorithm, MD5, is used.

-param dwFlags [in]

Values to be passed on to CryptCreateHash.

-param dwCertEncodingType [in]

Specifies the encoding type used. It is always acceptable to specify both the certificate and message encoding types by combining them with a bitwise-OR operation as shown in the following example:

X509_ASN_ENCODING | PKCS_7_ASN_ENCODING

Currently defined encoding types are:

  • X509_ASN_ENCODING
  • PKCS_7_ASN_ENCODING

-param pInfo [in]

A pointer to a CERT_PUBLIC_KEY_INFO structure that contains the public key information to be encoded and hashed.

-param pbComputedHash [out]

A pointer to a buffer to receive the computed hash.

To set the size of this information for memory allocation purposes, this parameter can be NULL. For more information, see Retrieving Data of Unknown Length.

-param pcbComputedHash [in, out]

A pointer to a DWORD that contains the size, in bytes, of the buffer pointed to by the pbComputedHash parameter. When the function returns, the DWORD contains the number of bytes stored in the buffer.

Note  When processing the data returned in the buffer, applications need to use the actual size of the data returned. The actual size can be slightly smaller than the size of the buffer specified on input. On input, buffer sizes are usually specified large enough to ensure that the largest possible output data will fit in the buffer. On output, the variable pointed to by this parameter is updated to reflect the actual size of the data copied to the buffer.
 

-returns

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

If the function fails, it returns zero (FALSE). For extended error information, call GetLastError.

Note  Errors from the called functions CryptCreateHash, CryptGetHashParam, and CryptHashData can be propagated to this function. This function has the following error codes.
 
Return code Description
ERROR_MORE_DATA
If the buffer specified by the pbComputedHash parameter is not large enough to hold the returned data, the function sets the ERROR_MORE_DATA code, and stores the required buffer size, in bytes, in the variable pointed to by pcbComputedHash.
ERROR_FILE_NOT_FOUND
Invalid certificate encoding type. Currently only X509_ASN_ENCODING is supported.
 

If the function fails, GetLastError may return an Abstract Syntax Notation One (ASN.1) encoding/decoding error. For information about these errors, see ASN.1 Encoding/Decoding Return Values.

-see-also

CryptHashCertificate

CryptHashToBeSigned

Data Management Functions