crypt32: Add special case for certificates with no signature algorithm.

This commit is contained in:
Juan Lang 2007-09-06 10:00:59 -07:00 committed by Alexandre Julliard
parent d82f3f37a2
commit 5b02947937
2 changed files with 11 additions and 2 deletions

View File

@ -651,6 +651,11 @@ BOOL WINAPI CertGetCertificateChain(HCERTCHAINENGINE hChainEngine,
SetLastError(E_INVALIDARG);
return FALSE;
}
if (!pCertContext->pCertInfo->SignatureAlgorithm.pszObjId)
{
SetLastError(ERROR_INVALID_DATA);
return FALSE;
}
if (!hChainEngine)
hChainEngine = CRYPT_GetDefaultChainEngine();
/* FIXME: what about HCCE_LOCAL_MACHINE? */

View File

@ -1668,13 +1668,17 @@ static void testGetCertChain(void)
*/
/* Tests with an invalid cert (one whose signature is bad) */
SetLastError(0xdeadbeef);
ret = CertGetCertificateChain(NULL, cert, NULL, NULL, &para, 0, NULL,
&chain);
ok(!ret, "Expected failure\n");
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
"Expected ERROR_INVALID_DATA, got %d\n", GetLastError());
para.cbSize = sizeof(para);
SetLastError(0xdeadbeef);
ret = CertGetCertificateChain(NULL, cert, NULL, NULL, &para, 0, NULL,
&chain);
ok(!ret, "Expected failure\n");
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
"Expected ERROR_INVALID_DATA, got %d\n", GetLastError());
CertFreeCertificateContext(cert);
for (i = 0; i < sizeof(chainCheck) / sizeof(chainCheck[0]); i++)