CryptGetMessageCertificates function
Applies to: desktop apps only
The CryptGetMessageCertificates function returns the handle of an open certificate store containing the message's certificates and CRLs. This function calls CertOpenStore using provider type CERT_STORE_PROV_PKCS7 as its lpszStoreProvider parameter.
Syntax
HCERTSTORE WINAPI CryptGetMessageCertificates( __in DWORD dwMsgAndCertEncodingType, __in HCRYPTPROV_LEGACY hCryptProv, __in DWORD dwFlags, __in const BYTE *pbSignedBlob, __in DWORD cbSignedBlob );
Parameters
- dwMsgAndCertEncodingType [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
- hCryptProv [in]
-
This parameter is not used and should be set to NULL.
Windows Server 2003, Windows XP, and Windows 2000: Handle of the CSP passed to CertOpenStore. For more information, see CertOpenStore.Unless there is a strong reason for passing a specific cryptographic provider in hCryptProv, pass zero to cause the default RSA or DSS provider to be acquired.
This parameter's data type is HCRYPTPROV.
- dwFlags [in]
-
Flags passed to CertOpenStore. For more information, see CertOpenStore.
- pbSignedBlob [in]
-
A pointer to a buffered CRYPT_INTEGER_BLOB structure that contains the signed message.
- cbSignedBlob [in]
-
The size, in bytes, of the signed message.
Return value
Returns the certificate store containing the message's certificates and CRLs. For an error, NULL is returned.
The following lists the error code most commonly returned by the GetLastError function.
| Return code | Description |
|---|---|
|
Invalid message and certificate encoding types. Currently only PKCS_7_ASN_ENCODING and X509_ASN_ENCODING are 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.
Remarks
Use GetLastError to determine the reason for any errors.
Examples
For an example that uses this function, see Example C Program: Setting and Getting Certificate Store Properties.
Requirements
|
Minimum supported client | Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
Send comments about this topic to Microsoft
Build date: 3/6/2012