Michael Karcher : crypt32: CertGetPublicKeyLength should check only cert encoding type.
Alexandre Julliard
julliard at winehq.org
Mon May 26 13:12:42 CDT 2008
Module: wine
Branch: master
Commit: 8d4d7b267de514c3c72820faa31c3403a4a488cf
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8d4d7b267de514c3c72820faa31c3403a4a488cf
Author: Michael Karcher <wine at mkarcher.dialup.fu-berlin.de>
Date: Sun May 25 19:23:44 2008 +0200
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.
---
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 41d3998..b916ce3 100644
--- a/dlls/crypt32/cert.c
+++ b/dlls/crypt32/cert.c
@@ -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;
diff --git a/dlls/crypt32/tests/cert.c b/dlls/crypt32/tests/cert.c
index 3fce85e..64aba83 100644
--- a/dlls/crypt32/tests/cert.c
+++ b/dlls/crypt32/tests/cert.c
@@ -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)
More information about the wine-cvs
mailing list