42static const BYTE bin3[] = {0x02,0x02,0x00,0x80};
43static const BYTE bin4[] = {0x02,0x02,0x01,0x00};
45static const BYTE bin6[] = {0x02,0x02,0xff,0x7f};
46static const BYTE bin7[] = {0x02,0x04,0xba,0xdd,0xf0,0x0d};
65static const BYTE bin8[] = {0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0};
66static const BYTE bin9[] = {0x02,0x0a,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0xff,0};
67static const BYTE bin10[] = {0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0};
69static const BYTE bin11[] = {0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0xff,0xff,0};
70static const BYTE bin12[] = {0x02,0x09,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0};
71static const BYTE bin13[] = {0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0};
78static const BYTE bin14[] = {0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0};
79static const BYTE bin15[] = {0x02,0x0a,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0xff,0};
80static const BYTE bin16[] = {0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0xff,0xff,0xff,0};
81static const BYTE bin17[] = {0x02,0x0c,0x00,0xff,0xff,0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0};
105 "Expected ERROR_FILE_NOT_FOUND, got %d\n",
GetLastError());
114 "Expected STATUS_ACCESS_VIOLATION, got %08x\n",
GetLastError());
127 ok(
buf[0] == 2,
"Got unexpected type %d for integer (expected 2)\n",
132 "Encoded value of 0x%08x didn't match expected\n",
ints[
i].
val);
146 ok(
buf[0] == 2,
"Got unexpected type %d for integer (expected 2)\n",
151 "Encoded value of 0x%08x didn't match expected\n",
ints[
i].
val);
170 ok(
buf[0] == 2,
"Got unexpected type %d for integer (expected 2)\n",
176 "Encoded value didn't match expected\n");
193 ok(
buf[0] == 2,
"Got unexpected type %d for integer (expected 2)\n",
199 "Encoded value didn't match expected\n");
207 static const BYTE bigInt[] = { 2, 5, 0xff, 0xfe, 0xff, 0xfe, 0xff };
208 static const BYTE testStr[] = { 0x16, 4,
't',
'e',
's',
't' };
209 static const BYTE longForm[] = { 2, 0x81, 0x01, 0x01 };
210 static const BYTE bigBogus[] = { 0x02, 0x84, 0x01, 0xff, 0xff, 0xf9 };
211 static const BYTE extraBytes[] = { 2, 1, 1, 0, 0, 0, 0 };
225 "Expected ERROR_FILE_NOT_FOUND, got %d\n",
GetLastError());
231 "Expected CRYPT_E_ASN1_EOD or OSS_BAD_ARG, got %08x\n",
GetLastError());
233 ret = pCryptDecodeObjectEx(dwEncoding,
X509_INTEGER, bigInt, bigInt[1] + 2,
237 "Expected CRYPT_E_ASN1_LARGE, got %d\n",
GetLastError());
239 ret = pCryptDecodeObjectEx(dwEncoding,
X509_INTEGER, testStr, testStr[1] + 2,
243 "Expected CRYPT_E_ASN1_BADTAG or OSS_PDU_MISMATCH, got %08x\n",
253 "Expected success and NOERROR, got %d\n",
GetLastError());
259 ok(
buf !=
NULL,
"Expected allocated buffer\n");
273 "Expected success and NOERROR, got %d\n",
GetLastError());
279 ok(
buf !=
NULL,
"Expected allocated buffer\n");
288 "Unexpected value\n");
298 "Expected success and NOERROR, got %d\n",
GetLastError());
304 ok(
buf !=
NULL,
"Expected allocated buffer\n");
313 "Unexpected value\n");
323 ok(*(
int *)
buf == 1,
"Expected 1, got %d\n", *(
int *)
buf);
332 ok(*(
int *)
buf == 1,
"Expected 1, got %d\n", *(
int *)
buf);
355 "Expected STATUS_ACCESS_VIOLATION, got %08x\n",
GetLastError());
360static const BYTE bin19[] = {0x0a,0x05,0x00,0xff,0xff,0xff,0x80};
395 "Got unexpected type %d for enumerated (expected 0xa)\n",
401 "Encoded value of 0x%08x didn't match expected\n",
426 "Got unexpected size %d for enumerated\n",
bufSize);
449 ret = pCryptEncodeObjectEx(dwEncoding, structType, &ft,
455 (
time->sysTime.wYear >= 1950 &&
time->sysTime.wYear <= 2050))
459 ok(
buf !=
NULL,
"Expected an allocated buffer\n");
463 "Expected type 0x%02x, got 0x%02x\n",
time->encodedTime[0],
465 ok(
buf[1] ==
time->encodedTime[1],
"Expected %d bytes, got %d\n",
468 "Got unexpected value for time encoding\n");
475 "Expected CRYPT_E_BAD_ENCODE, got 0x%08x\n",
GetLastError());
517 "Got unexpected value for time decoding:\nexpected %s, got %s\n",
528 ret = pCryptDecodeObjectEx(dwEncoding, structType,
time->encodedTime,
534 (
time->sysTime.wYear >= 1950 &&
time->sysTime.wYear <= 2050))
537 "CryptDecodeObjectEx failed: %d (0x%08x)\n",
GetLastError(),
545 "Expected CRYPT_E_ASN1_BADTAG or OSS_PDU_MISMATCH, got %08x\n",
550 0x17,0x0d,
'0',
'5',
'0',
'6',
'0',
'6',
'1',
'6',
'1',
'0',
'0',
'0',
'Z'};
552 0x18,0x0f,
'1',
'9',
'4',
'5',
'0',
'6',
'0',
'6',
'1',
'6',
'1',
'0',
'0',
'0',
'Z'};
554 0x18,0x0f,
'2',
'1',
'4',
'5',
'0',
'6',
'0',
'6',
'1',
'6',
'1',
'0',
'0',
'0',
'Z'};
557 { { 2005, 6, 1, 6, 16, 10, 0, 0 },
bin20 },
558 { { 1945, 6, 1, 6, 16, 10, 0, 0 },
bin21 },
559 { { 2145, 6, 1, 6, 16, 10, 0, 0 },
bin22 },
575 0x18,0x13,
'1',
'9',
'4',
'5',
'0',
'6',
'0',
'6',
'1',
'6',
'1',
'0',
'0',
'0',
'.',
'0',
'0',
'0',
'Z'};
577 0x18,0x13,
'1',
'9',
'4',
'5',
'0',
'6',
'0',
'6',
'1',
'6',
'1',
'0',
'0',
'0',
'.',
'9',
'9',
'9',
'Z'};
579 0x18,0x13,
'1',
'9',
'4',
'5',
'0',
'6',
'0',
'6',
'1',
'6',
'1',
'0',
'0',
'0',
'+',
'0',
'1',
'0',
'0'};
581 0x18,0x13,
'1',
'9',
'4',
'5',
'0',
'6',
'0',
'6',
'1',
'6',
'1',
'0',
'0',
'0',
'-',
'0',
'1',
'0',
'0'};
583 0x18,0x13,
'1',
'9',
'4',
'5',
'0',
'6',
'0',
'6',
'1',
'6',
'1',
'0',
'0',
'0',
'-',
'0',
'1',
'1',
'5'};
585 0x18,0x0a,
'2',
'1',
'4',
'5',
'0',
'6',
'0',
'6',
'1',
'6'};
587 0x17,0x0a,
'4',
'5',
'0',
'6',
'0',
'6',
'1',
'6',
'1',
'0'};
589 0x17,0x0b,
'4',
'5',
'0',
'6',
'0',
'6',
'1',
'6',
'1',
'0',
'Z'};
591 0x17,0x0d,
'4',
'5',
'0',
'6',
'0',
'6',
'1',
'6',
'1',
'0',
'+',
'0',
'1'};
593 0x17,0x0d,
'4',
'5',
'0',
'6',
'0',
'6',
'1',
'6',
'1',
'0',
'-',
'0',
'1'};
595 0x17,0x0f,
'4',
'5',
'0',
'6',
'0',
'6',
'1',
'6',
'1',
'0',
'+',
'0',
'1',
'0',
'0'};
597 0x17,0x0f,
'4',
'5',
'0',
'6',
'0',
'6',
'1',
'6',
'1',
'0',
'-',
'0',
'1',
'0',
'0'};
599 0x17,0x08,
'4',
'5',
'0',
'6',
'0',
'6',
'1',
'6'};
601 0x18,0x0f,
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'Z'};
603 0x18,0x04,
'2',
'1',
'4',
'5'};
605 0x18,0x08,
'2',
'1',
'4',
'5',
'0',
'6',
'0',
'6'};
610 { { 1945, 6, 1, 6, 16, 10, 0, 0 },
bin23 },
611 { { 1945, 6, 1, 6, 16, 10, 0, 999 },
bin24 },
612 { { 1945, 6, 1, 6, 17, 10, 0, 0 },
bin25 },
613 { { 1945, 6, 1, 6, 15, 10, 0, 0 },
bin26 },
614 { { 1945, 6, 1, 6, 14, 55, 0, 0 },
bin27 },
615 { { 2145, 6, 1, 6, 16, 0, 0, 0 },
bin28 },
616 { { 2045, 6, 1, 6, 16, 10, 0, 0 },
bin29 },
617 { { 2045, 6, 1, 6, 16, 10, 0, 0 },
bin30 },
618 { { 2045, 6, 1, 6, 17, 10, 0, 0 },
bin31 },
619 { { 2045, 6, 1, 6, 15, 10, 0, 0 },
bin32 },
620 { { 2045, 6, 1, 6, 17, 10, 0, 0 },
bin33 },
621 { { 2045, 6, 1, 6, 15, 10, 0, 0 },
bin34 },
626 static const unsigned char *bogusTimes[] = {
664 bogusTimes[
i], bogusTimes[
i][1] + 2, 0,
NULL, &ft1, &
size);
668 "Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x\n",
679 0x30,0x23,0x31,0x21,0x30,0x0c,0x06,0x03,0x55,0x04,0x04,
680 0x13,0x05,0x4c,0x61,0x6e,0x67,0x00,0x30,0x11,0x06,0x03,0x55,0x04,0x03,
681 0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0};
6830x30,0x2e,0x31,0x2c,0x30,0x2a,0x06,0x03,0x55,0x04,0x03,0x30,0x23,0x31,0x21,
6840x30,0x0c,0x06,0x03,0x55,0x04,0x04,0x13,0x05,0x4c,0x61,0x6e,0x67,0x00,0x30,
6850x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,
693 0x6f, 0x6c, 0x69, 0x73 };
695 0x76, 0x65, 0x72, 0x73 };
696static const BYTE wine[] = { 0x57, 0x69, 0x6e, 0x65, 0x20, 0x44, 0x65, 0x76,
697 0x65, 0x6c, 0x6f, 0x70, 0x6d, 0x65, 0x6e, 0x74 };
700static const BYTE aric[] = { 0x61, 0x72, 0x69, 0x63, 0x40, 0x63, 0x6f, 0x64,
701 0x65, 0x77, 0x65, 0x61, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x63, 0x6f, 0x6d };
703#define RDNA(arr) oid_ ## arr, CERT_RDN_PRINTABLE_STRING, { sizeof(arr), (LPBYTE)arr }
704#define RDNIA5(arr) oid_ ## arr, CERT_RDN_IA5_STRING, { sizeof(arr), (LPBYTE)arr }
7320x30,0x81,0x96,0x31,0x81,0x93,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,
7330x53,0x30,0x10,0x06,0x03,0x55,0x04,0x03,0x13,0x09,0x6c,0x6f,0x63,0x61,0x6c,0x68,
7340x6f,0x73,0x74,0x30,0x10,0x06,0x03,0x55,0x04,0x08,0x13,0x09,0x4d,0x69,0x6e,0x6e,
7350x65,0x73,0x6f,0x74,0x61,0x30,0x12,0x06,0x03,0x55,0x04,0x07,0x13,0x0b,0x4d,0x69,
7360x6e,0x6e,0x65,0x61,0x70,0x6f,0x6c,0x69,0x73,0x30,0x12,0x06,0x03,0x55,0x04,0x0a,
7370x13,0x0b,0x43,0x6f,0x64,0x65,0x57,0x65,0x61,0x76,0x65,0x72,0x73,0x30,0x17,0x06,
7380x03,0x55,0x04,0x0b,0x13,0x10,0x57,0x69,0x6e,0x65,0x20,0x44,0x65,0x76,0x65,0x6c,
7390x6f,0x70,0x6d,0x65,0x6e,0x74,0x30,0x21,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,
7400x01,0x09,0x01,0x16,0x14,0x61,0x72,0x69,0x63,0x40,0x63,0x6f,0x64,0x65,0x77,0x65,
7410x61,0x76,0x65,0x72,0x73,0x2e,0x63,0x6f,0x6d
761 "Expected STATUS_ACCESS_VIOLATION, got %08x\n",
GetLastError());
772 "Got unexpected encoding for empty name\n");
782 "Expected STATUS_ACCESS_VIOLATION, got %08x\n",
GetLastError());
795 "Got unexpected encoding for empty RDN array\n");
806 "Expected STATUS_ACCESS_VIOLATION, got %08x\n",
GetLastError());
822 attrs[0].
pszObjId = oid_common_name;
838 "Got unexpected encoding for two RDN array\n");
853 "Unexpected value for re-encoded two RDN array\n");
885 0x30,0x21,0x31,0x1f,0x30,0x0b,0x06,0x03,0x55,0x04,0x04,0x13,0x04,0x4c,0x61,
886 0x6e,0x67,0x30,0x10,0x06,0x03,0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,
887 0x20,0x4c,0x61,0x6e,0x67 };
889 0x30,0x2f,0x31,0x2d,0x30,0x2b,0x06,0x03,0x55,0x04,0x03,0x1e,0x24,0x23,0x30,
890 0x21,0x31,0x0c,0x30,0x03,0x06,0x04,0x55,0x13,0x04,0x4c,0x05,0x6e,0x61,0x00,
891 0x67,0x11,0x30,0x03,0x06,0x04,0x55,0x13,0x03,0x4a,0x0a,0x61,0x75,0x20,0x6e,
892 0x61,0x4c,0x67,0x6e };
911 "Expected STATUS_ACCESS_VIOLATION, got %08x\n",
GetLastError());
922 "Got unexpected encoding for empty name\n");
928 attrs[0].
pszObjId = oid_common_name;
939 "Expected CRYPT_E_INVALID_PRINTABLE_STRING, got %08x\n",
GetLastError());
940 ok(
size == 9,
"Unexpected error index %08x\n",
size);
944 attrs[0].
pszObjId = oid_common_name;
962 "Got unexpected encoding for two RDN array\n");
977 "Unexpected value for re-encoded two RDN array\n");
1000 win_skip(
"Can't handle CERT_RDN_UTF8_STRING\n");
1005 "Expected string type %d, got %d\n",
expected->dwValueType,
1009 "String type %d: unexpected data size, got %d, expected %d\n",
1014 "String type %d: unexpected value\n",
expected->dwValueType);
1027 "Got unexpected OID %s, expected %s\n", got->
pszObjId,
1057 for (
i = 0;
i < got->
cRDN;
i++)
1064 0x30,0x23,0x31,0x21,0x30,0x0c,0x06,0x03,0x55,0x04,0x04,
1065 0x13,0x05,0x4c,0x61,0x6e,0x67,0x00,0x30,0x11,0x06,0x03,0x55,0x04,0x03,
1066 0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0,0,0,0,0,0};
1090 "Expected 0 RDNs in empty info, got %d\n",
1103 "Expected 0 RDNs in empty info, got %d\n",
1119 info->cRDN == 1 &&
info->rgRDN &&
info->rgRDN[0].cRDNAttr == 0,
1120 "Got unexpected value for empty RDN\n");
1185 "Got wrong bufSize %d\n",
bufSize);
1187 "Expected 0 RDNs in empty info, got %d\n",
1203 info->cRDN == 1 &&
info->rgRDN &&
info->rgRDN[0].cRDNAttr == 0,
1204 "Got unexpected value for empty RDN\n");
1247 0x04,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 };
1249 0x12,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 };
1251 0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 };
1253 0x14,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 };
1255 0x15,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 };
1257 0x16,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 };
1259 0x19,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 };
1261 0x1a,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 };
1263 0x1b,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 };
1265 0x1e,0x14,0x00,0x4a,0x00,0x75,0x00,0x61,0x00,0x6e,0x00,0x20,0x00,0x4c,0x00,
1266 0x61,0x00,0x6e,0x00,0x67,0x00,0x00 };
1268 0x0c,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 };
1271 0x16,0x07,0x66,0x6f,0x6f,0x00,0x63,0x6f,0x6d };
1332 "Unexpected encoding\n");
1340 "Type %d: CryptEncodeObjectEx failed: %08x\n",
1347 "Got unexpected encoding\n");
1354 "Type %d: CryptEncodeObjectEx failed: %08x\n",
1361 "Got unexpected encoding\n");
1379 ok(
ret,
"Value type %d: CryptDecodeObjectEx failed: %08x\n",
1410 "Expected CERT_RDN_ENCODED_BLOB or CERT_RDN_IA5_STRING, got %d\n",
1419 "String type %d: unexpected data size, got %d, expected %d\n",
1424 "String type %d: unexpected value\n",
expected->dwValueType);
1432static const WCHAR url[] = {
'h',
't',
't',
'p',
':',
'/',
'/',
'w',
'i',
'n',
'e',
1433 'h',
'q',
'.',
'o',
'r',
'g',0 };
1435 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x69, 0x6e, 0x65, 0x68, 0x71, 0x2e,
1439static const WCHAR dnsName[] = {
'w',
'i',
'n',
'e',
'h',
'q',
'.',
'o',
'r',
'g',0 };
1441 0x6e, 0x65, 0x68, 0x71, 0x2e, 0x6f, 0x72, 0x67 };
1446 0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,
'J',
'u',
'a',
'n',
' ',
'L',
'a',
'n',
'g',0};
14490x30,0x19,0xa4,0x17,0x30,0x15,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,0x03,
14500x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x00 };
1459 char oid[] =
"1.2.3";
1502 "Expected CRYPT_E_INVALID_IA5_STRING, got %08x\n",
GetLastError());
1505 "Expected invalid char at index 7, got %d\n",
1542 U(
entry).pszRegisteredID = oid;
1567 static const BYTE unimplementedType[] = { 0x30, 0x06, 0x85, 0x04, 0x7f,
1569 static const BYTE bogusType[] = { 0x30, 0x06, 0x89, 0x04, 0x7f, 0x00, 0x00,
1571 static const BYTE dns_embedded_null[] = { 0x30,0x10,0x82,0x0e,0x66,0x6f,
1572 0x6f,0x2e,0x63,0x6f,0x6d,0x00,0x62,0x61,0x64,0x64,0x69,0x65 };
1573 static const BYTE dns_embedded_bell[] = { 0x30,0x10,0x82,0x0e,0x66,0x6f,
1574 0x6f,0x2e,0x63,0x6f,0x6d,0x07,0x62,0x61,0x64,0x64,0x69,0x65 };
1575 static const BYTE url_embedded_null[] = { 0x30,0x10,0x86,0x0e,0x66,0x6f,
1576 0x6f,0x2e,0x63,0x6f,0x6d,0x00,0x62,0x61,0x64,0x64,0x69,0x65 };
1588 "Expected CRYPT_E_ASN1_BADTAG or OSS_DATA_ERROR, got %08x\n",
1595 "Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x\n",
1605 ok(
info->cAltEntry == 0,
"Expected 0 entries, got %d\n",
1616 ok(
info->cAltEntry == 1,
"Expected 1 entries, got %d\n",
1619 "Expected CERT_ALT_NAME_URL, got %d\n",
1620 info->rgAltEntry[0].dwAltNameChoice);
1621 ok(
U(
info->rgAltEntry[0]).pwszURL ==
NULL || !*
U(
info->rgAltEntry[0]).pwszURL,
1622 "Expected empty URL\n");
1635 ok(
info->cAltEntry == 1,
"Expected 1 entries, got %d\n",
1638 "Expected CERT_ALT_NAME_URL, got %d\n",
1639 info->rgAltEntry[0].dwAltNameChoice);
1650 ok(
info->cAltEntry == 1,
"Expected 1 entries, got %d\n",
1653 "Expected CERT_ALT_NAME_DNS_NAME, got %d\n",
1654 info->rgAltEntry[0].dwAltNameChoice);
1656 "Unexpected DNS name\n");
1666 ok(
info->cAltEntry == 1,
"Expected 1 entries, got %d\n",
1669 "Expected CERT_ALT_NAME_IP_ADDRESS, got %d\n",
1670 info->rgAltEntry[0].dwAltNameChoice);
1672 "Unexpected IP address length %d\n",
1673 U(
info->rgAltEntry[0]).IPAddress.cbData);
1675 sizeof(
localhost)),
"Unexpected IP address value\n");
1685 ok(
info->cAltEntry == 1,
"Expected 1 entries, got %d\n",
1688 "Expected CERT_ALT_NAME_REGISTERED_ID, got %d\n",
1689 info->rgAltEntry[0].dwAltNameChoice);
1690 ok(!
strcmp(
U(
info->rgAltEntry[0]).pszRegisteredID,
"1.2.3"),
1691 "Expected OID 1.2.3, got %s\n",
U(
info->rgAltEntry[0]).pszRegisteredID);
1702 ok(
info->cAltEntry == 1,
"Expected 1 entries, got %d\n",
1705 "Expected CERT_ALT_NAME_DIRECTORY_NAME, got %d\n",
1706 info->rgAltEntry[0].dwAltNameChoice);
1707 ok(
U(
info->rgAltEntry[0]).DirectoryName.cbData ==
1709 U(
info->rgAltEntry[0]).DirectoryName.cbData);
1712 "Unexpected directory name value\n");
1733 ok(
info->cAltEntry == 1,
"Expected 1 entries, got %d\n",
1736 "Expected CERT_ALT_NAME_DNS_NAME, got %d\n",
1737 info->rgAltEntry[0].dwAltNameChoice);
1790static BYTE nihongoT61[] = { 0x14,0x09,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x6f,
1794static BYTE nihongoBMP[] = { 0x1e,0x12,0x00,0x68,0x00,0x74,0x00,0x74,0x00,0x70,
1795 0x00,0x3a,0x00,0x2f,0x00,0x2f,0x22,0x6f,0x57,0x5b };
1797 0xe2,0x89,0xaf,0xe5,0x9d,0x9b };
1833 "Expected STATUS_ACCESS_VIOLATION, got %08x\n",
GetLastError());
1836 value.dwValueType = 0;
1838 value.Value.cbData = 0;
1842 "Expected CRYPT_E_NOT_CHAR_STRING, got %08x\n",
GetLastError());
1847 "Expected CRYPT_E_NOT_CHAR_STRING, got %08x\n",
GetLastError());
1853 "Expected CRYPT_E_NOT_CHAR_STRING, got %08x\n",
GetLastError());
1858 "Expected CRYPT_E_NOT_CHAR_STRING, got %08x\n",
GetLastError());
1866 "Expected CRYPT_E_NOT_CHAR_STRING, got %08x\n",
GetLastError());
1868 value.Value.cbData = 0;
1876 "Value type %d: expected %08x, got %08x\n",
value.dwValueType,
1879 "Expected error index %d, got %d\n",
unicodeErrors[
i].errorIndex,
1883 value.Value.cbData = 0;
1895 "Value type %d: expected size %d, got %d\n",
1898 "Value type %d: unexpected value\n",
value.dwValueType);
1916 "Value type %d: expected size %d, got %d\n",
1919 "Value type %d: unexpected value\n",
value.dwValueType);
1927 if (
n <= 0)
return 0;
1928 while ((--
n > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; }
1929 return *str1 - *str2;
1953 value->dwValueType);
1956 "Unexpected decoded value for index %d (value type %d)\n",
i,
1966 's',
'o',
'm',
'e',
'l',
'o',
'n',
'g',0xff,
's',
't',
'r',
'i',
'n',
'g' };
1968 ASN_OCTETSTRING,15,
's',
'o',
'm',
'e',
'l',
'o',
'n',
'g',0xff,
's',
't',
'r',
'i',
'n',
'g' };
1976 static const struct {
1977 const BYTE *decoded;
2007 ok(
bufSize ==
tests[
i].encoded_size,
"[%u] buf size %u expected %u\n",
2009 ok(
buf[0] == 4,
"Got unexpected type %d for octet string (expected 4)\n",
buf[0]);
2023 {
ASN_CONSTRUCTOR|
ASN_OCTETSTRING,8,
ASN_CONSTRUCTOR|
ASN_OCTETSTRING,0x80,
ASN_OCTETSTRING,2,
'h',
'i', 0,0, 0,0 };
2031 static const struct {
2032 const BYTE *encoded;
2034 const BYTE *decoded;
2085 "[%u] Expected size >= %d, got %d\n",
i,
2087 ok(
buf !=
NULL,
"Expected allocated buffer\n");
2092 ok (
blob->cbData ==
tests[
i].decoded_size,
"[%u] cbData = %u\n",
i,
blob->cbData);
2095 "Unexpected value\n");
2111static const unsigned char bin52[] = { 0x03,0x03,0x00,0xff,0xff };
2112static const unsigned char bin53[] = { 0xff,0xff };
2113static const unsigned char bin54[] = { 0x03,0x03,0x01,0xff,0xfe };
2114static const unsigned char bin55[] = { 0xff,0xfe };
2115static const unsigned char bin56[] = { 0x03,0x02,0x01,0xfe };
2116static const unsigned char bin57[] = { 0xfe };
2146 "%d: Got unexpected size %d, expected %d\n",
i,
bufSize,
2149 "%d: Unexpected value\n",
i);
2157 static const BYTE ber[] =
"\x03\x02\x01\xff";
2158 static const BYTE berDecoded = 0xfe;
2176 "Got unexpected size %d\n",
bufSize);
2179 "Got unexpected length %d, expected %d\n",
blob->cbData,
2183 "Unexpected value\n");
2190 ret = pCryptDecodeObjectEx(dwEncoding,
X509_BITS, ber, ber[1] + 2,
2198 "Got unexpected size %d\n",
bufSize);
2200 ok(
blob->cbData ==
sizeof(berDecoded),
2201 "Got unexpected length %d\n",
blob->cbData);
2203 ok(*
blob->pbData == berDecoded,
"Unexpected value\n");
2214static const unsigned char bin59[] = { 0x30,0x00 };
2215static const unsigned char bin60[] = { 0x30,0x03,0x01,0x01,0xff };
2216static const unsigned char bin61[] = { 0x30,0x03,0x02,0x01,0x00 };
2217static const unsigned char bin62[] = { 0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 };
2233 0x06, 0x0a, 0x09, 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64, 0x01, 0x19, 0x16,
2234 0x03, 0x6f, 0x72, 0x67, 0x30, 0x14, 0x06, 0x0a, 0x09, 0x92, 0x26, 0x89, 0x93,
2235 0xf2, 0x2c, 0x64, 0x01, 0x19, 0x16, 0x06, 0x77, 0x69, 0x6e, 0x65, 0x68, 0x71 };
2237 0x30, 0x2d, 0x30, 0x2b, 0x31, 0x29, 0x30, 0x11, 0x06, 0x0a, 0x09, 0x92, 0x26,
2238 0x89, 0x93, 0xf2, 0x2c, 0x64, 0x01, 0x19, 0x16, 0x03, 0x6f, 0x72, 0x67, 0x30,
2239 0x14, 0x06, 0x0a, 0x09, 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64, 0x01, 0x19,
2240 0x16, 0x06, 0x77, 0x69, 0x6e, 0x65, 0x68, 0x71 };
2269 info.SubjectType.cbData = 0;
2271 info.cSubtreesConstraint = 0;
2280 "Unexpected value\n");
2286 info.cSubtreesConstraint = 1;
2287 info.rgSubtreesConstraint = &nameBlob;
2302static const unsigned char bin63[] = { 0x30,0x06,0x01,0x01,0x01,0x02,0x01,0x01 };
2306 static const BYTE inverted[] = { 0x30, 0x06, 0x02, 0x01, 0x01, 0x01, 0x01,
2320 ok(
ret,
"CryptDecodeObjectEx failed for item %d: %08x\n",
i,
2328 "Unexpected value for item %d\n",
i);
2339 "Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x\n",
2341 ok(!
buf,
"Expected buf to be set to NULL\n");
2361 "Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x\n",
2372 ok(
info->SubjectType.cbData == 0,
"Expected no subject type\n");
2373 ok(!
info->fPathLenConstraint,
"Expected no path length constraint\n");
2374 ok(
info->cSubtreesConstraint == 0,
"Expected no subtree constraints\n");
2385 ok(
info->SubjectType.cbData == 0,
"Expected no subject type\n");
2386 ok(!
info->fPathLenConstraint,
"Expected no path length constraint\n");
2387 ok(
info->cSubtreesConstraint == 1,
"Expected a subtree constraint\n");
2388 if (
info->cSubtreesConstraint &&
info->rgSubtreesConstraint)
2390 ok(
info->rgSubtreesConstraint[0].cbData ==
2392 info->rgSubtreesConstraint[0].cbData);
2405static const BYTE mod1_encoded[] = { 0x30,0x0f,0x02,0x08,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x02,0x03,0x01,0x00,0x01 };
2406static const BYTE mod2_encoded[] = { 0x30,0x0c,0x02,0x05,0x01,0x01,0x01,0x01,0x01,0x02,0x03,0x01,0x00,0x01 };
2407static const BYTE mod3_encoded[] = { 0x30,0x0c,0x02,0x05,0x01,0x01,0x01,0x01,0x80,0x02,0x03,0x01,0x00,0x01 };
2408static const BYTE mod4_encoded[] = { 0x30,0x10,0x02,0x09,0x00,0x80,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x02,0x03,0x01,0x00,0x01 };
2439 rsaPubKey->
magic = 0x31415352;
2441 rsaPubKey->
pubexp = 65537;
2490 "Expected ERROR_FILE_NOT_FOUND, got %08x\n",
GetLastError());
2494 "Expected ERROR_FILE_NOT_FOUND, got %08x\n",
GetLastError());
2510 "Unexpected value\n");
2529 "Expected CRYPT_E_ASN1_EOD or OSS_MORE_INPUT, got %08x\n",
2536 "Expected ERROR_FILE_NOT_FOUND, got %08x\n",
GetLastError());
2541 "Expected ERROR_FILE_NOT_FOUND, got %08x\n",
GetLastError());
2559 "Expected type PUBLICKEYBLOB (%d), got %d\n",
PUBLICKEYBLOB,
2562 "Expected version CUR_BLOB_VERSION (%d), got %d\n",
2564 ok(
hdr->reserved == 0,
"Expected reserved 0, got %d\n",
2567 "Expected CALG_RSA_KEYX, got %08x\n",
hdr->aiKeyAlg);
2568 ok(rsaPubKey->
magic == 0x31415352,
2569 "Expected magic RSA1, got %08x\n", rsaPubKey->
magic);
2571 "Wrong bit len %d\n", rsaPubKey->
bitlen);
2572 ok(rsaPubKey->
pubexp == 65537,
"Expected pubexp 65537, got %d\n",
2576 "Unexpected modulus\n");
2583 0x7f, 0x02, 0x02, 0x00, 0x80, 0x02, 0x02, 0x01, 0x00, 0x02, 0x01, 0x80, 0x02,
2584 0x02, 0xff, 0x7f, 0x02, 0x04, 0xba, 0xdd, 0xf0, 0x0d };
2587 0x36, 0x30, 0x36, 0x31, 0x36, 0x31, 0x30, 0x30, 0x30, 0x5a, 0x02, 0x01, 0x7f,
2588 0x02, 0x02, 0x00, 0x80, 0x02, 0x02, 0x01, 0x00, 0x02, 0x01, 0x80, 0x02, 0x02,
2589 0xff, 0x7f, 0x02, 0x04, 0xba, 0xdd, 0xf0, 0x0d };
2630 "Unexpected value\n");
2653 "Expected %d bytes, got %d\n",
ints[
i].encoded[1] + 2,
2656 ints[
i].encoded[1] + 2),
"Unexpected value\n");
2671 "Expected %d bytes, got %d\n",
times[0].encodedTime[1] + 2,
2674 times[0].encodedTime[1] + 2),
"Unexpected value\n");
2697static const BYTE ext1[] = { 0x30,0x14,0x30,0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,
2698 0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 };
2699static const BYTE ext2[] = { 0x30,0x11,0x30,0x0f,0x06,0x03,0x55,0x1d,0x13,0x04,
2700 0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 };
2701static const BYTE ext3[] = { 0x30,0x07,0x30,0x05,0x06,0x01,0x29,0x04,0x00 };
2728 "Unexpected value\n");
2753 ok(
ext->cExtension ==
exts[
i].exts.cExtension,
2754 "Expected %d extensions, see %d\n",
exts[
i].exts.cExtension,
2756 for (
j = 0;
j <
min(
ext->cExtension,
exts[
i].exts.cExtension);
j++)
2759 exts[
i].exts.rgExtension[
j].pszObjId),
2760 "Expected OID %s, got %s\n",
2761 exts[
i].exts.rgExtension[
j].pszObjId,
2762 ext->rgExtension[
j].pszObjId);
2764 exts[
i].exts.rgExtension[
j].Value.pbData,
2765 exts[
i].exts.rgExtension[
j].Value.cbData),
2766 "Unexpected value\n");
2797static const BYTE aKey[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd,
2802 0x30,0x0b,0x30,0x06,0x06,0x02,0x2a,0x03,0x05,0x00,0x03,0x01,0x00};
2804 0x30,0x09,0x30,0x04,0x06,0x02,0x2a,0x03,0x03,0x01,0x00};
2806 0x30,0x0f,0x30,0x0a,0x06,0x06,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x05,0x00,0x03,0x01,0x00};
2808 0x30,0x0d,0x30,0x08,0x06,0x06,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x03,0x01,0x00};
2810 0x30,0x1f,0x30,0x0a,0x06,0x06,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x05,0x00,0x03,0x11,0x00,0x00,0x01,
2811 0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f};
2813 0x30,0x1d,0x30,0x08,0x06,0x06,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x03,0x11,0x00,0x00,0x01,
2814 0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f};
2816 0x30,0x20,0x30,0x0b,0x06,0x06,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x01,0x01,
2817 0x03,0x11,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,
2820 0x30,0x20,0x30,0x0b,0x06,0x06,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x01,0x01,
2821 0x03,0x11,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,
2823static unsigned char bin72[] = { 0x05,0x00};
2869 "Unexpected value\n");
2879 "Expected OID %s, got %s\n",
expected->Algorithm.pszObjId,
2883 "Expected parameters of %d bytes, got %d\n",
2885 if (
expected->Algorithm.Parameters.cbData)
2888 "Unexpected algorithm parameters\n");
2890 "Expected public key of %d bytes, got %d\n",
2899 static const BYTE bogusPubKeyInfo[] = { 0x30, 0x22, 0x30, 0x0d, 0x06, 0x06,
2900 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03,
2901 0x11, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
2902 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
2938 "Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x\n",
2942static const BYTE v1Cert[] = { 0x30, 0x33, 0x02, 0x00, 0x30, 0x02, 0x06, 0x00,
2943 0x30, 0x22, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30,
2944 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30,
2945 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x30, 0x07, 0x30,
2946 0x02, 0x06, 0x00, 0x03, 0x01, 0x00 };
2947static const BYTE v2Cert[] = { 0x30, 0x38, 0xa0, 0x03, 0x02, 0x01, 0x01, 0x02,
2948 0x00, 0x30, 0x02, 0x06, 0x00, 0x30, 0x22, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31,
2949 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f,
2950 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30,
2951 0x30, 0x5a, 0x30, 0x07, 0x30, 0x02, 0x06, 0x00, 0x03, 0x01, 0x00 };
2952static const BYTE v3Cert[] = { 0x30, 0x38, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02,
2953 0x00, 0x30, 0x02, 0x06, 0x00, 0x30, 0x22, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31,
2954 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f,
2955 0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30,
2956 0x30, 0x5a, 0x30, 0x07, 0x30, 0x02, 0x06, 0x00, 0x03, 0x01, 0x00 };
29580x30,0x38,0xa0,0x03,0x02,0x01,0x03,0x02,0x00,0x30,0x02,0x06,0x00,0x30,0x22,
29590x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,0x30,0x30,
29600x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30,0x30,
29610x30,0x30,0x30,0x5a,0x30,0x07,0x30,0x02,0x06,0x00,0x03,0x01,0x00 };
2963 0x02, 0x06, 0x00, 0x30, 0x22, 0x18, 0x0f, 0x31, 0x36, 0x30, 0x31, 0x30, 0x31,
2964 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x31, 0x36,
2965 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a,