crypt32: CertGetPublicKeyLength should check only cert encoding type.

pktextract calls CertGetPublicKeyLength with dwCertEncodingType
of X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, MSDN explicitly
allows it.
This commit is contained in:
Michael Karcher 2008-05-25 19:23:44 +02:00 committed by Alexandre Julliard
parent 8fa3b6871f
commit 8d4d7b267d
2 changed files with 6 additions and 1 deletions

View File

@ -809,7 +809,7 @@ DWORD WINAPI CertGetPublicKeyLength(DWORD dwCertEncodingType,
TRACE("(%08x, %p)\n", dwCertEncodingType, pPublicKey);
if (dwCertEncodingType != X509_ASN_ENCODING)
if (GET_CERT_ENCODING_TYPE(dwCertEncodingType) != X509_ASN_ENCODING)
{
SetLastError(ERROR_FILE_NOT_FOUND);
return 0;

View File

@ -2958,6 +2958,11 @@ static void testGetPublicKeyLength(void)
SetLastError(0xdeadbeef);
ret = CertGetPublicKeyLength(X509_ASN_ENCODING, &info);
ok(ret == 56, "Expected length 56, got %d\n", ret);
/* With the RSA OID and a message encoding */
info.Algorithm.pszObjId = oid_rsa_rsa;
SetLastError(0xdeadbeef);
ret = CertGetPublicKeyLength(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, &info);
ok(ret == 56, "Expected length 56, got %d\n", ret);
}
START_TEST(cert)