crypt32: Test and implement CryptGetMessageSignerCount.
This commit is contained in:
parent
b9038be1ff
commit
e52c80e53b
|
@ -123,7 +123,7 @@
|
|||
@ stdcall CryptGetDefaultOIDDllList(long long ptr ptr)
|
||||
@ stdcall CryptGetDefaultOIDFunctionAddress(long long wstr long ptr ptr)
|
||||
@ stdcall CryptGetMessageCertificates(long ptr long ptr long)
|
||||
@ stub CryptGetMessageSignerCount
|
||||
@ stdcall CryptGetMessageSignerCount(long ptr long)
|
||||
@ stdcall CryptGetOIDFunctionAddress(long long str long ptr ptr)
|
||||
@ stdcall CryptGetOIDFunctionValue(long str str wstr ptr ptr ptr)
|
||||
@ stdcall CryptHashCertificate(long long long ptr long ptr ptr)
|
||||
|
|
|
@ -2286,3 +2286,25 @@ HCERTSTORE WINAPI CryptGetMessageCertificates(DWORD dwMsgAndCertEncodingType,
|
|||
return CertOpenStore(CERT_STORE_PROV_PKCS7, dwMsgAndCertEncodingType,
|
||||
hCryptProv, dwFlags, &blob);
|
||||
}
|
||||
|
||||
LONG WINAPI CryptGetMessageSignerCount(DWORD dwMsgEncodingType,
|
||||
const BYTE *pbSignedBlob, DWORD cbSignedBlob)
|
||||
{
|
||||
HCRYPTMSG msg;
|
||||
LONG count = -1;
|
||||
|
||||
TRACE("(%08x, %p, %d)\n", dwMsgEncodingType, pbSignedBlob, cbSignedBlob);
|
||||
|
||||
msg = CryptMsgOpenToDecode(dwMsgEncodingType, 0, 0, 0, NULL, NULL);
|
||||
if (msg)
|
||||
{
|
||||
if (CryptMsgUpdate(msg, pbSignedBlob, cbSignedBlob, TRUE))
|
||||
{
|
||||
DWORD size = sizeof(count);
|
||||
|
||||
CryptMsgGetParam(msg, CMSG_SIGNER_COUNT_PARAM, 0, &count, &size);
|
||||
}
|
||||
CryptMsgClose(msg);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
|
|
@ -2347,6 +2347,43 @@ static void test_msg_control(void)
|
|||
/* FIXME: need to test with a message with a valid signature and signer */
|
||||
}
|
||||
|
||||
static void test_msg_get_signer_count(void)
|
||||
{
|
||||
LONG count;
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
count = CryptGetMessageSignerCount(0, NULL, 0);
|
||||
ok(count == -1, "Expected -1, got %d\n", count);
|
||||
ok(GetLastError() == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n",
|
||||
GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
count = CryptGetMessageSignerCount(PKCS_7_ASN_ENCODING, NULL, 0);
|
||||
ok(count == -1, "Expected -1, got %d\n", count);
|
||||
ok(GetLastError() == CRYPT_E_ASN1_EOD,
|
||||
"Expected CRYPT_E_ASN1_EOD, got %08x\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
count = CryptGetMessageSignerCount(PKCS_7_ASN_ENCODING,
|
||||
dataEmptyBareContent, sizeof(dataEmptyBareContent));
|
||||
ok(count == -1, "Expected -1, got %d\n", count);
|
||||
ok(GetLastError() == CRYPT_E_ASN1_BADTAG,
|
||||
"Expected CRYPT_E_ASN1_BADTAG, got %08x\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
count = CryptGetMessageSignerCount(PKCS_7_ASN_ENCODING,
|
||||
dataEmptyContent, sizeof(dataEmptyContent));
|
||||
ok(count == -1, "Expected -1, got %d\n", count);
|
||||
ok(GetLastError() == CRYPT_E_INVALID_MSG_TYPE,
|
||||
"Expected CRYPT_E_INVALID_MSG_TYPE, got %08x\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
count = CryptGetMessageSignerCount(PKCS_7_ASN_ENCODING,
|
||||
signedEmptyBareContent, sizeof(signedEmptyBareContent));
|
||||
ok(count == -1, "Expected -1, got %d\n", count);
|
||||
ok(GetLastError() == CRYPT_E_ASN1_BADTAG,
|
||||
"Expected CRYPT_E_ASN1_BADTAG, got %08x\n", GetLastError());
|
||||
count = CryptGetMessageSignerCount(PKCS_7_ASN_ENCODING,
|
||||
signedEmptyContent, sizeof(signedEmptyContent));
|
||||
ok(count == 1, "Expected 1, got %d\n", count);
|
||||
}
|
||||
|
||||
START_TEST(msg)
|
||||
{
|
||||
init_function_pointers();
|
||||
|
@ -2363,4 +2400,7 @@ START_TEST(msg)
|
|||
test_hash_msg();
|
||||
test_signed_msg();
|
||||
test_decode_msg();
|
||||
|
||||
/* simplified message functions */
|
||||
test_msg_get_signer_count();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue