Commit 5c0d8a3a authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

wintrust: Add tests for WVTAsn1SpcFinancialCriteriaInfoEncode.

parent c196e2ee
......@@ -29,6 +29,43 @@
static BOOL (WINAPI *pCryptDecodeObjectEx)(DWORD,LPCSTR,const BYTE*,DWORD,DWORD,PCRYPT_DECODE_PARA,void*,DWORD*);
static BOOL (WINAPI *pCryptEncodeObjectEx)(DWORD,LPCSTR,const void*,DWORD,PCRYPT_ENCODE_PARA,void*,DWORD*);
static const BYTE falseCriteria[] = { 0x30,0x06,0x01,0x01,0x00,0x01,0x01,0x00 };
static const BYTE trueCriteria[] = { 0x30,0x06,0x01,0x01,0xff,0x01,0x01,0xff };
static void test_encodeSPCFinancialCriteria(void)
{
BOOL ret;
DWORD size = 0;
LPBYTE buf;
SPC_FINANCIAL_CRITERIA criteria = { FALSE, FALSE };
if (!pCryptEncodeObjectEx)
{
skip("CryptEncodeObjectEx() is not available. Skipping the encodeFinancialCriteria tests\n");
return;
}
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_FINANCIAL_CRITERIA_STRUCT,
&criteria, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
todo_wine
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
if (ret)
{
ok(size == sizeof(falseCriteria), "Unexpected size %d\n", size);
ok(!memcmp(buf, falseCriteria, size), "Unexpected value\n");
LocalFree(buf);
}
criteria.fFinancialInfoAvailable = criteria.fMeetsCriteria = TRUE;
ret = pCryptEncodeObjectEx(X509_ASN_ENCODING, SPC_FINANCIAL_CRITERIA_STRUCT,
&criteria, CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
todo_wine
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
if (ret)
{
ok(size == sizeof(trueCriteria), "Unexpected size %d\n", size);
ok(!memcmp(buf, trueCriteria, size), "Unexpected value\n");
LocalFree(buf);
}
}
static WCHAR url[] = { 'h','t','t','p',':','/','/','w','i','n','e','h','q','.',
'o','r','g',0 };
......@@ -727,6 +764,7 @@ START_TEST(asn)
pCryptDecodeObjectEx = (void*)GetProcAddress(hCrypt32, "CryptDecodeObjectEx");
pCryptEncodeObjectEx = (void*)GetProcAddress(hCrypt32, "CryptEncodeObjectEx");
test_encodeSPCFinancialCriteria();
test_encodeSPCLink();
test_decodeSPCLink();
test_encodeSPCPEImage();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment