Share via


CryptMsgVerifyCountersignatureEncoded (Compact 2013)

3/28/2014

This function verifies a countersignature in terms of the SignerInfo structure (as defined by PKCS #7).

Syntax

BOOL WINAPI CryptMsgVerifyCountersignatureEncoded (
    __in HCRYPTPROV_LEGACY hCryptProv,
    __in DWORD dwEncodingType,
    __in PBYTE pbSignerInfo,
    __in DWORD cbSignerInfo,
    __in PBYTE pbSignerInfoCountersignature,
    __in DWORD cbSignerInfoCountersignature,
    __in PCERT_INFO pciCountersigner
    );

Parameters

  • hCryptProv
    [int] Parameter is not used and must be set to NULL.
  • dwEncodingType
    [in] Specifies the encoding type used. Only X509_ASN_ENCODING and PKCS_7_ASN_ENCODING are used. For either encoding type, use: X509_ASN_ENCODING | PKCS_7_ASN_ENCODING.
  • pbSignerInfo
    [in] Pointer to the encoded BLOB that contains the signer of the contents of a message to be countersigned.
  • cbSignerInfo
    [in] Count, in bytes, of the encoded BLOB for the signer of the contents.
  • pbSignerInfoCountersignature
    [in] Pointer to the encoded BLOB that contains the countersigner information.
  • cbSignerInfoCountersignature
    [in] Count, in bytes, of the encoded BLOB for the countersigner of the message.
  • pciCountersigner
    [in] Pointer to a CERT_INFO structure that includes the issuer and serial number of the countersigner. For more information, see Remarks.

Return Value

If the function succeeds, the return value is nonzero (TRUE); otherwise, it is zero (FALSE).

For extended error information, call GetLastError.

The following table shows the error codes most commonly returned by the GetLastError function.

Error code

Description

CRYPT_E_AUTH_ATTR_MISSING

The message does not contain an expected authenticated attribute.

CRYPT_E_HASH_VALUE

The hash value is not correct.

CRYPT_E_UNEXPECTED_ENCODING

The message is not encoded as expected.

CRYPT_E_UNKNOWN_ALGO

The cryptographic algorithm is unknown.

E_INVALIDARG

One or more arguments are not valid.

E_OUTOFMEMORY

Ran out of memory.

Propagated errors from the following functions might be returned.

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

Countersigner verification is done using the PKCS #7 SignerInfo structure. The signature must contain the encrypted hash of the encryptedDigest field of pbSignerInfo.

The issuer and serial number of the countersigner must match the countersigner information from pbSignerInfoCountersignature. The only fields referenced from pciCountersigner are SerialNumber, Issuer, and SubjectPublicKeyInfo. The SubjectPublicKeyInfo is used to access the public key that is then used to encrypt the hash from the pciCountersigner to compare it with the hash from the pbSignerInfo.

Requirements

Header

wincrypt.h

Library

crypt32.lib

See Also

Reference

Certificates Functions