[PATCH] CertGetPublicKeyLength should check only cert encoding type.
Michael Karcher
wine at mkarcher.dialup.fu-berlin.de
Sun May 25 12:23:44 CDT 2008
pktextract calls CertGetPublicKeyLength with dwCertEncodingType
of X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, MSDN explicitly
allows it.
---
dlls/crypt32/cert.c | 2 +-
dlls/crypt32/tests/cert.c | 5 +++++
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c
index 3eb9e2d..f3c8c46 100644
--- a/dlls/crypt32/cert.c
+++ b/dlls/crypt32/cert.c
@@ -854,7 +854,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;
diff --git a/dlls/crypt32/tests/cert.c b/dlls/crypt32/tests/cert.c
index 5acdc0e..bf1333f 100644
--- a/dlls/crypt32/tests/cert.c
+++ b/dlls/crypt32/tests/cert.c
@@ -2980,6 +2980,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)
--
1.5.5.1
More information about the wine-patches
mailing list