-------------------------------------------------------------------------------------------------------------------
CERT_CONTEXT *cc=CertCreateCertificateContext(X509_ASN_ENCODING |
PKCS_7_ASN_ENCODING, bCer, dwCerSize);
CryptAcquireCertificatePrivateKey(cc, 0, NULL, &hProv, &hKey, NULL);
CryptGetUserKey(hProv,AT_SIGNATURE,&hKey); //Key is correct. i've
dumped it to a file to be sure
CryptCreateHash(hProv, CALG_SHA1, 0, 0, &hHash);
CryptHashData(hHash, bData, dwDataSize, 0); //Hash is correct for
sure.
CryptVerifySignature(hHash, bSign, dwSigSize, hKey, NULL, 0); //
ERROR_INVALID_PARAMETER
--------------------------------------------------------------------------------------------------------------------
i'm sure (because i've checked it out) that everything until
'CryptVerifySignature' is correct and computed in the right way and i
don't make use of 'CryptAcquireContext' because, if i got it right,
it's done via 'CryptAcquireCertificatePrivateKey'. Anyway i've tried
even using 'CryptAcquireContext' without success.
Maybe there is something that i'm missing or got wrong but ALL the
pointers are ok and i've no doubt about it.
I don't really know what else to try and i hope that someone out there
can point me in the right direction.
Thanks in advance.
Fulvio
Is the signature you are passing to CryptVerifySignature coming from
another call to CAPI or some external source? If it is an external
source you may need to byte swap it since CAPI expects all inputs to
be little endian.