The CRYPT_VERIFY_MESSAGE_PARA structure is used to verify signed messages.
typedef struct _CRYPT_VERIFY_MESSAGE_PARA {
DWORD cbSize;
DWORD dwMsgAndCertEncodingType;
HCRYPTPROV hCryptProv;
PFN_CRYPT_GET_SIGNER_CERTIFICATE pfnGetSignerCertificate;
void* pvGetArg;
} CRYPT_VERIFY_MESSAGE_PARA, *PCRYPT_VERIFY_MESSAGE_PARA;
X509_ASN_ENCODING | PKCS_7_ASN_ENCODING
Currently defined encoding types are shown in the following table.
Encoding type | Value |
---|---|
X509_ASN_ENCODING | 0x00000001 |
PKCS_7_ASN_ENCODING | 0x00010000 |
Unless there is a strong reason for passing in a specific cryptographic provider in hCryptProv, zero should be passed in. Passing in zero causes the default RSA or DSS provider to be acquired before doing hash, signature verification or recipient encryption operations.
An application-defined callback function that gets the signer's certificate can be used in place of the default. It gets passed the certificate ID of the signer (its issuer and serial number) and a handle to its cryptographic signed message's certificate store.
PCCERT_CONTEXT WINAPI CryptGetSignerCertificateCallback (
void* pvGetArg // in
DWORD dwMsgAndCertEncodingType // in
PCERT_INFO pSignerId // in
HCERTSTORE hMsgCertStore); // in
If the message doesn't contain any content or signers, then the function is called with pSignerId == NULL.
For a found signer certificate, the function returns a pointer to a read-only CERT_CONTEXT. The returned CERT_CONTEXT is either obtained from a certificate store or was created via CertCreateCertificateContext. For either case, it is freed via CertFreeCertificateContext.
If a certificate for the signer wasn't found, NULL is returned.
Callback Function Parameters
X509_ASN_ENCODING | PKCS_7_ASN_ENCODING
Currently defined encoding types are shown in the following table.
Encoding type | Value |
---|---|
X509_ASN_ENCODING | 0x00000001 |
PKCS_7_ASN_ENCODING | 0x00010000 |
CERT_CONTEXT, CERT_INFO, CryptDecryptAndVerifyMessageSignature, CryptVerifyDetachedMessageSignature, CryptVerifyMessageSignature