diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c index 41d399814f..b916ce3c80 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 3fce85e6bf..64aba8337c 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)