38#define ENHANCED_PROV (iProv == 0)
39#define BASE_PROV (iProv == 1)
40#define STRONG_PROV (iProv == 2)
52 {
'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',0x2,0x2,
'k',
'l',0},
55 {
'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',0x2,0x2,0},
58 {
'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',0},
61 {
'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',
'i',
'j',
'k',
'l',0},
77 static const char szContainer_md5[] =
"9d20fd8d05ed2b8455d125d0bf6d6a70";
78 static const char szCryptography[] =
"Software\\Microsoft\\Cryptography";
79 static const char szMachineGuid[] =
"MachineGuid";
117 for (
i = 0;
i < dwLen-7;
i+=8) {
118 trace(
"0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x,\n",
122 for (
j=0;
i<dwLen;
j++,
i++) {
126 trace(
"%s\n", szTemp);
153 win_skip(
"RSA full provider not available\n");
161 win_skip(
"Couldn't create crypto provider\n");
208 win_skip(
"RSA_AES provider not supported\n");
260 skip(
"PP_SIG_KEYSIZE_INC is not supported (win9x or NT)\n");
270 skip(
"PP_KEYX_KEYSIZE_INC is not supported (win9x or NT)\n");
278 BYTE rnd1[16], rnd2[16];
280 memset(rnd1, 0,
sizeof(rnd1));
281 memset(rnd2, 0,
sizeof(rnd2));
294 ok(
memcmp(rnd1, rnd2,
sizeof(rnd1)),
"CryptGenRandom generates non random data\n");
301 unsigned char pbData[2000];
305 for (
i=0;
i<2000;
i++)
pbData[
i] = (
unsigned char)
i;
327 0x07, 0x02, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00,
328 0x52, 0x53, 0x41, 0x32, 0x00, 0x04, 0x00, 0x00,
329 0x01, 0x00, 0x01, 0x00, 0x9b, 0x64, 0xef, 0xce,
330 0x31, 0x7c, 0xad, 0x56, 0xe2, 0x1e, 0x9b, 0x96,
331 0xb3, 0xf0, 0x29, 0x88, 0x6e, 0xa8, 0xc2, 0x11,
332 0x33, 0xd6, 0xcc, 0x8c, 0x69, 0xb2, 0x1a, 0xfd,
333 0xfc, 0x23, 0x21, 0x30, 0x4d, 0x29, 0x45, 0xb6,
334 0x3a, 0x67, 0x11, 0x80, 0x1a, 0x91, 0xf2, 0x9f,
335 0x01, 0xac, 0xc0, 0x11, 0x50, 0x5f, 0xcd, 0xb9,
336 0xad, 0x76, 0x9f, 0x6e, 0x91, 0x55, 0x71, 0xda,
337 0x97, 0x96, 0x96, 0x22, 0x75, 0xb4, 0x83, 0x44,
338 0x89, 0x9e, 0xf8, 0x44, 0x40, 0x7c, 0xd6, 0xcd,
339 0x9d, 0x88, 0xd6, 0x88, 0xbc, 0x56, 0xb7, 0x64,
340 0xe9, 0x2c, 0x24, 0x2f, 0x0d, 0x78, 0x55, 0x1c,
341 0xb2, 0x67, 0xb1, 0x5e, 0xbc, 0x0c, 0xcf, 0x1c,
342 0xe9, 0xd3, 0x9e, 0xa2, 0x15, 0x24, 0x73, 0xd6,
343 0xdb, 0x6f, 0x83, 0xb2, 0xf8, 0xbc, 0xe7, 0x47,
344 0x3b, 0x01, 0xef, 0x49, 0x08, 0x98, 0xd6, 0xa3,
345 0xf9, 0x25, 0x57, 0xe9, 0x39, 0x3c, 0x53, 0x30,
346 0x1b, 0xf2, 0xc9, 0x62, 0x31, 0x43, 0x5d, 0x84,
347 0x24, 0x30, 0x21, 0x9a, 0xad, 0xdb, 0x62, 0x91,
348 0xc8, 0x07, 0xd9, 0x2f, 0xd6, 0xb5, 0x37, 0x6f,
349 0xfe, 0x7a, 0x12, 0xbc, 0xd9, 0xd2, 0x2b, 0xbf,
350 0xd7, 0xb1, 0xfa, 0x7d, 0xc0, 0x48, 0xdd, 0x74,
351 0xdd, 0x55, 0x04, 0xa1, 0x8b, 0xc1, 0x0a, 0xc4,
352 0xa5, 0x57, 0x62, 0xee, 0x08, 0x8b, 0xf9, 0x19,
353 0x6c, 0x52, 0x06, 0xf8, 0x73, 0x0f, 0x24, 0xc9,
354 0x71, 0x9f, 0xc5, 0x45, 0x17, 0x3e, 0xae, 0x06,
355 0x81, 0xa2, 0x96, 0x40, 0x06, 0xbf, 0xeb, 0x9e,
356 0x80, 0x2b, 0x27, 0x20, 0x8f, 0x38, 0xcf, 0xeb,
357 0xff, 0x3b, 0x38, 0x41, 0x35, 0x69, 0x66, 0x13,
358 0x1d, 0x3c, 0x01, 0x3b, 0xf6, 0x37, 0xca, 0x9c,
359 0x61, 0x74, 0x98, 0xcf, 0xc9, 0x6e, 0xe8, 0x90,
360 0xc7, 0xb7, 0x33, 0xc0, 0x07, 0x3c, 0xf8, 0xc8,
361 0xf6, 0xf2, 0xd7, 0xf0, 0x21, 0x62, 0x58, 0x8a,
362 0x55, 0xbf, 0xa1, 0x2d, 0x3d, 0xa6, 0x69, 0xc5,
363 0x02, 0x19, 0x31, 0xf0, 0x94, 0x0f, 0x45, 0x5c,
364 0x95, 0x1b, 0x53, 0xbc, 0xf5, 0xb0, 0x1a, 0x8f,
365 0xbf, 0x40, 0xe0, 0xc7, 0x73, 0xe7, 0x72, 0x6e,
366 0xeb, 0xb1, 0x0f, 0x38, 0xc5, 0xf8, 0xee, 0x04,
367 0xed, 0x34, 0x1a, 0x10, 0xf9, 0x53, 0x34, 0xf3,
368 0x3e, 0xe6, 0x5c, 0xd1, 0x47, 0x65, 0xcd, 0xbd,
369 0xf1, 0x06, 0xcb, 0xb4, 0xb1, 0x26, 0x39, 0x9f,
370 0x71, 0xfe, 0x3d, 0xf8, 0x62, 0xab, 0x22, 0x8b,
371 0x0e, 0xdc, 0xb9, 0xe8, 0x74, 0x06, 0xfc, 0x8c,
372 0x25, 0xa1, 0xa9, 0xcf, 0x07, 0xf9, 0xac, 0x21,
373 0x01, 0x7b, 0x1c, 0xdc, 0x94, 0xbd, 0x47, 0xe1,
374 0xa0, 0x86, 0x59, 0x35, 0x6a, 0x6f, 0xb9, 0x70,
375 0x26, 0x7c, 0x3c, 0xfd, 0xbd, 0x81, 0x39, 0x36,
376 0x42, 0xc2, 0xbd, 0xbe, 0x84, 0x27, 0x9a, 0x69,
377 0x81, 0xda, 0x99, 0x27, 0xc2, 0x4f, 0x62, 0x33,
378 0xf4, 0x79, 0x30, 0xc5, 0x63, 0x54, 0x71, 0xf1,
379 0x47, 0x22, 0x25, 0x9b, 0x6c, 0x00, 0x2f, 0x1c,
380 0xf4, 0x1f, 0x85, 0xbc, 0xf6, 0x67, 0x6a, 0xe3,
381 0xf6, 0x55, 0x8a, 0xef, 0xd0, 0x0b, 0xd3, 0xa2,
382 0xc5, 0x51, 0x70, 0x15, 0x0a, 0xf0, 0x98, 0x4c,
383 0xb7, 0x19, 0x62, 0x0e, 0x2d, 0x2a, 0x4a, 0x7d,
384 0x7a, 0x0a, 0xc4, 0x17, 0xe3, 0x5d, 0x20, 0x52,
385 0xa9, 0x98, 0xc3, 0xaa, 0x11, 0xf6, 0xbf, 0x4c,
386 0x94, 0x99, 0x81, 0x89, 0xf0, 0x7f, 0x66, 0xaa,
387 0xc8, 0x88, 0xd7, 0x31, 0x84, 0x71, 0xb6, 0x64,
388 0x09, 0x76, 0x0b, 0x7f, 0x1a, 0x1f, 0x2e, 0xfe,
389 0xcd, 0x59, 0x2a, 0x54, 0x11, 0x84, 0xd4, 0x6a,
390 0x61, 0xdf, 0xaa, 0x76, 0x66, 0x9d, 0x82, 0x11,
391 0x56, 0x3d, 0xd2, 0x52, 0xe6, 0x42, 0x5a, 0x77,
392 0x92, 0x98, 0x34, 0xf3, 0x56, 0x6c, 0x96, 0x10,
393 0x40, 0x59, 0x16, 0xcb, 0x77, 0x61, 0xe3, 0xbf,
394 0x4b, 0xd4, 0x39, 0xfb, 0xb1, 0x4e, 0xc1, 0x74,
395 0xec, 0x7a, 0xea, 0x3d, 0x68, 0xbb, 0x0b, 0xe6,
396 0xc6, 0x06, 0xbf, 0xdd, 0x7f, 0x94, 0x42, 0xc0,
397 0x0f, 0xe4, 0x92, 0x33, 0x6c, 0x6e, 0x1b, 0xba,
398 0x73, 0xf9, 0x79, 0x84, 0xdf, 0x45, 0x00, 0xe4,
399 0x94, 0x88, 0x9d, 0x08, 0x89, 0xcf, 0xf2, 0xa4,
400 0xc5, 0x47, 0x45, 0x85, 0x86, 0xa5, 0xcc, 0xa8,
401 0xf2, 0x5d, 0x58, 0x07
406 static const unsigned char md2hash[16] = {
407 0x12, 0xcb, 0x1b, 0x08, 0xc8, 0x48, 0xa4, 0xa9,
408 0xaa, 0xf3, 0xf1, 0x9f, 0xfc, 0x29, 0x28, 0x68 };
409 static const unsigned char md4hash[16] = {
410 0x8e, 0x2a, 0x58, 0xbf, 0xf2, 0xf5, 0x26, 0x23,
411 0x79, 0xd2, 0x92, 0x36, 0x1b, 0x23, 0xe3, 0x81 };
412 static const unsigned char empty_md5hash[16] = {
413 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04,
414 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e };
415 static const unsigned char md5hash[16] = {
416 0x15, 0x76, 0xa9, 0x4d, 0x6c, 0xb3, 0x34, 0xdd,
417 0x12, 0x6c, 0xb1, 0xc2, 0x7f, 0x19, 0xe0, 0xf2 };
418 static const unsigned char sha1hash[20] = {
419 0xf1, 0x0c, 0xcf, 0xde, 0x60, 0xc1, 0x7d, 0xb2, 0x6e, 0x7d,
420 0x85, 0xd3, 0x56, 0x65, 0xc7, 0x66, 0x1d, 0xbb, 0xeb, 0x2c };
421 static const unsigned char signed_ssl3_shamd5_hash[] = {
422 0x4f,0xcc,0x2f,0x33,0x44,0x60,0x76,0x16,0x13,0xc8,0xff,0xd4,0x59,0x19,
423 0xde,0x85,0x44,0x72,0x47,0x98,0x01,0xfb,0x67,0x5c,0x5b,0x35,0x15,0x0f,
424 0x91,0xda,0xc7,0x7c,0xfb,0xe2,0x18,0xef,0xac,0x31,0x40,0x7b,0xa9,0x83,
425 0xdb,0x30,0xcd,0x94,0x4b,0x8e,0x3b,0x6c,0x7a,0x86,0x59,0xf0,0xd1,0xd2,
426 0x5e,0xce,0xd4,0x1b,0x7f,0xed,0x24,0xee,0x53,0x5c,0x15,0x97,0x21,0x7c,
427 0x5c,0xea,0xab,0xf5,0xd6,0x4b,0xb3,0xbb,0x14,0xf5,0x59,0x9e,0x21,0x90,
428 0x21,0x99,0x19,0xad,0xa2,0xa6,0xea,0x61,0xc1,0x41,0xe2,0x70,0x77,0xf7,
429 0x15,0x68,0x96,0x1e,0x5c,0x84,0x97,0xe3,0x5c,0xd2,0xd9,0xfb,0x87,0x6f,
430 0x11,0x21,0x82,0x43,0x76,0x32,0xa4,0x38,0x7b,0x85,0x22,0x30,0x1e,0x55,
432 unsigned char pbData[2048];
436 BYTE pbHashValue[36];
437 BYTE pbSigValue[128];
442 for (
i=0;
i<2048;
i++)
pbData[
i] = (
unsigned char)
i;
461 ok(!
memcmp(pbHashValue, md2hash, 16),
"Wrong MD2 hash!\n");
478 cryptflags &= ~CRYPT_USERDATA;
479 ok(
broken(1),
"Failed to support CRYPT_USERDATA flag\n");
492 ok(!
memcmp(pbHashValue, md4hash, 16),
"Wrong MD4 hash!\n");
515 ok(!
memcmp(pbHashValue, md5hash, 16),
"Wrong MD5 hash!\n");
528 ok(!
memcmp(pbHashValue, empty_md5hash, 16),
"Wrong MD5 hash!\n");
534 ok(!
memcmp(pbHashValue, empty_md5hash, 16),
"Wrong MD5 hash!\n");
542 "Expected NTE_BAD_HASH_STATE or NTE_BAD_ALGID, got %08x\n",
GetLastError());
548 ok(!
memcmp(pbHashValue, empty_md5hash, 16),
"Wrong MD5 hash!\n");
560 if(pCryptDuplicateHash) {
561 result = pCryptDuplicateHash(
hHash, 0, 0, &hHashClone);
575 ok(!
memcmp(pbHashValue, sha1hash, 20),
"Wrong SHA1 hash!\n");
608 ok(!
result,
"CryptHashData succeeded\n");
614 ok(!
result,
"CryptDestroyHash succeeded\n");
617 if (!pCryptDuplicateHash)
619 win_skip(
"CryptDuplicateHash is not available\n");
691 ok(
len == 128,
"expected len 128, got %d\n",
len);
694 ok(!
memcmp(pbSigValue, signed_ssl3_shamd5_hash,
len),
"unexpected value\n");
695 if (
len != 128 ||
memcmp(pbSigValue, signed_ssl3_shamd5_hash,
len))
697 printBytes(
"expected", signed_ssl3_shamd5_hash,
698 sizeof(signed_ssl3_shamd5_hash));
711 static const BYTE plain[23] = {
712 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
713 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 };
714 static const BYTE ecb[24] = {
715 0xc0, 0x9a, 0xe4, 0x2f, 0x0a, 0x47, 0x67, 0x11, 0xf2, 0xb2, 0x5d, 0x5f,
716 0x08, 0xff, 0x49, 0xa4, 0x45, 0x3a, 0x68, 0x14, 0xca, 0x18, 0xe5, 0xf4 };
717 static const BYTE cbc[24] = {
718 0xc0, 0x9a, 0xe4, 0x2f, 0x0a, 0x47, 0x67, 0x11, 0x10, 0xf5, 0xda, 0x61,
719 0x4e, 0x3d, 0xab, 0xc0, 0x97, 0x85, 0x01, 0x12, 0x97, 0xa4, 0xf7, 0xd3 };
720 static const BYTE cfb[24] = {
721 0x29, 0xb5, 0x67, 0x85, 0x0b, 0x1b, 0xec, 0x07, 0x67, 0x2d, 0xa1, 0xa4,
722 0x1a, 0x47, 0x24, 0x6a, 0x54, 0xe1, 0xe0, 0x92, 0xf9, 0x0e, 0xf6, 0xeb };
731 memcpy(abData, plain,
sizeof(plain));
735 dwLen =
sizeof(dwMode);
746 ok(dwLen == 11 ||
broken(dwLen == 0 ),
"unexpected salt length %d\n", dwLen);
751 ok(dwLen == 24,
"Unexpected length %d\n", dwLen);
760 ok(
result && dwLen == 23 && !
memcmp(plain, abData,
sizeof(plain)),
770 ok(dwLen == 24,
"Unexpected length %d\n", dwLen);
778 ok(
result && dwLen == 23 && !
memcmp(plain, abData,
sizeof(plain)),
800 ok(
result && dwLen == 15 && !
memcmp(plain, abData,
sizeof(plain)),
807 ok(
broken(1),
"OFB mode not supported\n");
826 unsigned char pbData[16], enc_data[16], bad_data[16];
827 static const BYTE des112[16] = {
828 0x8e, 0x0c, 0x3c, 0xa3, 0x05, 0x88, 0x5f, 0x7a,
829 0x32, 0xa1, 0x06, 0x52, 0x64, 0xd2, 0x44, 0x1c };
845 ok(!
memcmp(
pbData, des112,
sizeof(des112)),
"3DES_112 encryption failed!\n");
887 ok(!
result,
"CryptDecrypt should failed!\n");
915 unsigned char pbData[16], enc_data[16], bad_data[16];
917 0x58, 0x86, 0x42, 0x46, 0x65, 0x4b, 0x92, 0x62,
918 0xcf, 0x0f, 0x65, 0x37, 0x43, 0x7a, 0x82, 0xb9 };
919 static const BYTE des_old_behavior[16] = {
920 0xb0, 0xfd, 0x11, 0x69, 0x76, 0xb1, 0xa1, 0x03,
921 0xf7, 0xbc, 0x23, 0xaa, 0xd4, 0xc1, 0xc9, 0x55 };
922 static const BYTE des_old_strong[16] = {
923 0x9b, 0xc1, 0x2a, 0xec, 0x4a, 0xf9, 0x0f, 0x14,
924 0x0a, 0xed, 0xf6, 0xd3, 0xdc, 0xad, 0xf7, 0x0c };
938 dwLen =
sizeof(
DWORD);
991 ok(!
result,
"CryptDecrypt should failed!\n");
1029 "DES encryption failed!\n");
1040 unsigned char pbData[16], enc_data[16], bad_data[16];
1041 static const BYTE des3[16] = {
1042 0x7b, 0xba, 0xdd, 0xa2, 0x39, 0xd3, 0x7b, 0xb3,
1043 0xc7, 0x51, 0x81, 0x41, 0x53, 0xe8, 0xcf, 0xeb };
1055 ok(!
memcmp(
pbData, des3,
sizeof(des3)),
"3DES encryption failed!\n");
1097 ok(!
result,
"CryptDecrypt should failed!\n");
1124 DWORD dwLen, dwMode;
1125 unsigned char pbData[48], enc_data[16], bad_data[16];
1127 static const BYTE aes_plain[32] = {
1128 "AES Test With 2 Blocks Of Data." };
1129 static const BYTE aes_cbc_enc[3][48] = {
1131 { 0xfe, 0x85, 0x3b, 0xe1, 0xf5, 0xe1, 0x58, 0x75, 0xd5, 0xa9, 0x74, 0xe3, 0x09, 0xea, 0xa5, 0x04,
1132 0x23, 0x35, 0xa2, 0x3b, 0x5c, 0xf1, 0x6c, 0x6f, 0xb9, 0xcd, 0x64, 0x06, 0x3e, 0x41, 0x83, 0xef,
1133 0x2a, 0xfe, 0xea, 0xb5, 0x6c, 0x17, 0x20, 0x79, 0x8c, 0x51, 0x3e, 0x56, 0xed, 0xe1, 0x47, 0x68 },
1135 { 0x6b, 0xf0, 0xfd, 0x32, 0xee, 0xc6, 0x06, 0x13, 0xa8, 0xe6, 0x3c, 0x81, 0x85, 0xb8, 0x2e, 0xa1,
1136 0xd4, 0x3b, 0xe8, 0x22, 0xa5, 0x74, 0x4a, 0xbe, 0x9d, 0xcf, 0xcc, 0x37, 0x26, 0x19, 0x5a, 0xd1,
1137 0x7f, 0x76, 0xbf, 0x94, 0x28, 0xce, 0x27, 0x21, 0x61, 0x87, 0xeb, 0xb9, 0x8b, 0xa8, 0xb4, 0x57 },
1139 { 0x20, 0x57, 0x17, 0x0b, 0x17, 0x76, 0xd8, 0x3b, 0x26, 0x90, 0x8b, 0x4c, 0xf2, 0x00, 0x79, 0x33,
1140 0x29, 0x2b, 0x13, 0x9c, 0xe2, 0x95, 0x09, 0xc1, 0xcd, 0x20, 0x87, 0x22, 0x32, 0x70, 0x9d, 0x75,
1141 0x9a, 0x94, 0xf5, 0x76, 0x5c, 0xb1, 0x62, 0x2c, 0xe1, 0x76, 0x7c, 0x86, 0x73, 0xe6, 0x7a, 0x23 }
1161 dwLen =
sizeof(aes_plain);
1165 ok(dwLen == 48,
"Expected dwLen 48, got %d\n", dwLen);
1166 ok(!
memcmp(aes_cbc_enc[
i],
pbData, dwLen),
"Expected equal data sequences\n");
1179 ok(!dwLen,
"unexpected salt length %d\n", dwLen);
1182 dwMode = 0xdeadbeef;
1183 dwLen =
sizeof(dwMode);
1232 ok(!
result,
"CryptDecrypt should failed!\n");
1257 static const unsigned char sha256hash[32] = {
1258 0x10, 0xfc, 0x3c, 0x51, 0xa1, 0x52, 0xe9, 0x0e, 0x5b, 0x90,
1259 0x31, 0x9b, 0x60, 0x1d, 0x92, 0xcc, 0xf3, 0x72, 0x90, 0xef,
1260 0x53, 0xc3, 0x5f, 0xf9, 0x25, 0x07, 0x68, 0x7d, 0x8a, 0x91,
1263 static const unsigned char sha384hash[48] = {
1264 0x98, 0xd3, 0x3f, 0x89, 0x0b, 0x23, 0x33, 0x44, 0x61, 0x32,
1265 0x5a, 0x7c, 0xa3, 0x03, 0x89, 0xb5, 0x11, 0xd7, 0x41, 0xc8,
1266 0x54, 0x6b, 0x12, 0x0c, 0x40, 0x15, 0xb6, 0x2a, 0x03, 0x43,
1267 0xe5, 0x64, 0x7f, 0x10, 0x1e, 0xae, 0x47, 0xa9, 0x39, 0x05,
1268 0x6f, 0x40, 0x60, 0x94, 0xd6, 0xad, 0x80, 0x55
1270 static const unsigned char sha512hash[64] = {
1271 0x37, 0x86, 0x0e, 0x7d, 0x25, 0xd9, 0xf9, 0x84, 0x3e, 0x3d,
1272 0xc7, 0x13, 0x95, 0x73, 0x42, 0x04, 0xfd, 0x13, 0xad, 0x23,
1273 0x39, 0x16, 0x32, 0x5f, 0x99, 0x3e, 0x3c, 0xee, 0x3f, 0x11,
1274 0x36, 0xf9, 0xc9, 0x66, 0x08, 0x70, 0xcc, 0x49, 0xd8, 0xe0,
1275 0x7d, 0xa1, 0x57, 0x62, 0x71, 0xa6, 0xc9, 0xa4, 0x24, 0x60,
1276 0xfc, 0xde, 0x9d, 0xb2, 0xf1, 0xd2, 0xc2, 0xfb, 0x2d, 0xbf,
1277 0xb7, 0xf4, 0x81, 0xd4
1279 unsigned char pbData[2048];
1282 BYTE pbHashValue[64];
1286 for (
i=0;
i<2048;
i++)
pbData[
i] = (
unsigned char)
i;
1292 win_skip(
"SHA-256/384/512 hashes are not supported before Windows XP SP3\n");
1308 ok(!
memcmp(pbHashValue, sha256hash, 32),
"Wrong SHA-256 hash!\n");
1329 ok(!
memcmp(pbHashValue, sha384hash, 48),
"Wrong SHA-384 hash!\n");
1350 ok(!
memcmp(pbHashValue, sha512hash, 64),
"Wrong SHA-512 hash!\n");
1359 static const BYTE rc2_40_encrypted[16] = {
1360 0xc0, 0x9a, 0xe4, 0x2f, 0x0a, 0x47, 0x67, 0x11,
1361 0xfb, 0x18, 0x87, 0xce, 0x0c, 0x75, 0x07, 0xb1 };
1362 static const BYTE rc2_128_encrypted[] = {
1363 0x82,0x81,0xf7,0xff,0xdd,0xd7,0x88,0x8c,
1364 0x2a,0x2a,0xc0,0xce,0x4c,0x89,0xb6,0x66 };
1365 static const BYTE rc2_40def_encrypted[] = {
1366 0x23,0xc8,0x70,0x13,0x42,0x2e,0xa8,0x98,
1367 0x5c,0xdf,0x7a,0x9b,0xea,0xdb,0x96,0x1b };
1368 static const BYTE rc2_40_salt_enh[24] = {
1369 0xA3, 0xD7, 0x41, 0x87, 0x7A, 0xD0, 0x18, 0xDB,
1370 0xD4, 0x6A, 0x4F, 0xEE, 0xF3, 0xCA, 0xCD, 0x34,
1371 0xB3, 0x15, 0x9A, 0x2A, 0x88, 0x5F, 0x43, 0xA5 };
1372 static const BYTE rc2_40_salt_base[24] = {
1373 0x8C, 0x4E, 0xA6, 0x00, 0x9B, 0x15, 0xEF, 0x9E,
1374 0x88, 0x81, 0xD0, 0x65, 0xD6, 0x53, 0x57, 0x08,
1375 0x0A, 0x77, 0x80, 0xFA, 0x7E, 0x89, 0x14, 0x55 };
1376 static const BYTE rc2_40_salt_strong[24] = {
1377 0xB9, 0x33, 0xB6, 0x7A, 0x35, 0xC3, 0x06, 0x88,
1378 0xBF, 0xD5, 0xCC, 0xAF, 0x14, 0xAE, 0xE2, 0x31,
1379 0xC6, 0x9A, 0xAA, 0x3F, 0x05, 0x2F, 0x22, 0xDA };
1383 DWORD dwLen, dwKeyLen, dwDataLen, dwMode, dwModeBits,
error;
1384 unsigned char pbData[2000], pbHashValue[16], pszBuffer[256];
1387 for (
i=0;
i<2000;
i++)
pbData[
i] = (
unsigned char)
i;
1406 dwLen =
sizeof(
DWORD);
1411 dwMode = 0xdeadbeef;
1412 dwLen =
sizeof(dwMode);
1421 dwLen =
sizeof(
DWORD);
1425 dwModeBits = 0xdeadbeef;
1426 dwLen =
sizeof(
DWORD);
1431 broken(dwModeBits == 0xffffffff),
1432 "expected CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_DECRYPT|CRYPT_ENCRYPT,"
1433 " got %08x\n", dwModeBits);
1435 dwLen =
sizeof(
DWORD);
1439 dwLen =
sizeof(
DWORD);
1442 ok(dwLen == 4,
"Expected 4, got %d\n", dwLen);
1449 ok(dwLen == 8,
"Expected 8, got %d\n", dwLen);
1455 ok(dwLen == 11,
"unexpected salt length %d\n", dwLen);
1459 for (
i=0;
i<dwLen;
i++)
1460 ok(!pszBuffer[
i],
"unexpected salt value %02x @ %d\n", pszBuffer[
i],
i);
1462 dwLen =
sizeof(
DWORD);
1474 ok(!
memcmp(
pbData, rc2_40_encrypted, 16),
"RC2 encryption failed!\n");
1492 ok(dwLen == 11,
"expected salt length 11, got %d\n", dwLen);
1494 ok(dwLen == 0 ||
broken(
nt4 && dwLen == 11),
"expected salt length 0, got %d\n", dwLen);
1497 for (
i=0;
i<24;
i++)
1505 ok(dwLen ==
i,
"size %d: unexpected salt length %d\n",
i, dwLen);
1519 for (
i=0;
i<2000;
i++)
pbData[
i] = (
unsigned char)
i;
1547 dwLen =
sizeof(dwKeyLen);
1564 ok(dwKeyLen == 128,
"Expected 128, got %d\n", dwKeyLen);
1572 ok(dwKeyLen == 40,
"Expected 40, got %d\n", dwKeyLen);
1575 dwLen =
sizeof(dwKeyLen);
1591 sizeof(rc2_128_encrypted)),
"RC2 encryption failed!\n");
1620 "RC2 encryption failed!\n");
1626 "Expected 0x80009005, got 0x%08X\n",
error);
1628 dwLen =
sizeof(
DWORD);
1632 ok(dwKeyLen == 40,
"Expected 40, got %d\n", dwKeyLen);
1634 dwLen =
sizeof(pszBuffer);
1635 memset(pszBuffer, 0xAF, dwLen);
1639 ok(dwLen == 11,
"Expected 11, got %d\n", dwLen);
1641 ok(dwLen == 0,
"Expected 0, got %d\n", dwLen);
1654 0x17, 0x0c, 0x44, 0x8e, 0xae, 0x90, 0xcd, 0xb0,
1655 0x7f, 0x87, 0xf5, 0x7a, 0xec, 0xb2, 0x2e, 0x35 };
1656 static const BYTE rc4_40_salt[16] = {
1657 0x41, 0xE6, 0x33, 0xC9, 0x50, 0xA1, 0xBF, 0x88,
1658 0x12, 0x4D, 0xD3, 0xE3, 0x47, 0x88, 0x6D, 0xA5 };
1659 static const BYTE rc4_40_salt_base[16] = {
1660 0x2F, 0xAC, 0xEA, 0xEA, 0xFF, 0x68, 0x7E, 0x77,
1661 0xF4, 0xB9, 0x48, 0x7C, 0x4E, 0x79, 0xA6, 0xB5 };
1665 DWORD dwDataLen = 5, dwKeyLen, dwLen =
sizeof(
DWORD), dwMode;
1666 unsigned char pbData[2000];
1667 unsigned char pszBuffer[256];
1670 for (
i=0;
i<2000;
i++)
pbData[
i] = (
unsigned char)
i;
1690 dwLen =
sizeof(
DWORD);
1693 ok(dwKeyLen == 56,
"Expected 56, got %d\n", dwKeyLen);
1695 dwLen =
sizeof(
DWORD);
1698 ok(dwKeyLen == 0,
"Expected 0, got %d\n", dwKeyLen);
1711 dwLen =
sizeof(
DWORD);
1715 "Expected 0, got %d\n", dwMode);
1739 ok(dwLen == 11,
"expected salt length 11, got %d\n", dwLen);
1741 ok(dwLen == 0 ||
broken(
nt4 && dwLen == 11),
"expected salt length 0, got %d\n", dwLen);
1744 for (
i=0;
i<24;
i++)
1752 ok(dwLen ==
i,
"size %d: unexpected salt length %d\n",
i, dwLen);
1780 "RC4 encryption failed!\n");
1782 dwLen =
sizeof(
DWORD);
1786 ok(dwKeyLen == 40,
"Expected 40, got %d\n", dwKeyLen);
1788 dwLen =
sizeof(pszBuffer);
1789 memset(pszBuffer, 0xAF, dwLen);
1793 ok(dwLen == 11,
"Expected 11, got %d\n", dwLen);
1795 ok(dwLen == 0,
"Expected 0, got %d\n", dwLen);
1813 static const BYTE hmac[16] = {
1814 0x1a, 0x7d, 0x49, 0xc5, 0x9b, 0x2d, 0x0b, 0x9c,
1815 0xcf, 0x10, 0x6b, 0xb6, 0x7d, 0x0f, 0x13, 0x32 };
1836 ok(!
memcmp(abData, hmac,
sizeof(hmac)),
"HMAC failed!\n");
1854 BYTE abData[256], abEnc[264];
1855 static const BYTE mac_40[8] = { 0xb7, 0xa2, 0x46, 0xe9, 0x11, 0x31, 0xe0, 0xad};
1878 ok(!
memcmp(abData, mac_40,
sizeof(mac_40)),
"MAC failed!\n");
1904 static BYTE abSessionKey[148] = {
1905 0x01, 0x02, 0x00, 0x00, 0x01, 0x68, 0x00, 0x00,
1906 0x00, 0xa4, 0x00, 0x00, 0xb8, 0xa4, 0xdf, 0x5e,
1907 0x9e, 0xb1, 0xbf, 0x85, 0x3d, 0x24, 0x2d, 0x1e,
1908 0x69, 0xb7, 0x67, 0x13, 0x8e, 0x78, 0xf2, 0xdf,
1909 0xc6, 0x69, 0xce, 0x46, 0x7e, 0xf2, 0xf2, 0x33,
1910 0x20, 0x6f, 0xa1, 0xa5, 0x59, 0x83, 0x25, 0xcb,
1911 0x3a, 0xb1, 0x8a, 0x12, 0x63, 0x02, 0x3c, 0xfb,
1912 0x4a, 0xfa, 0xef, 0x8e, 0xf7, 0x29, 0x57, 0xb1,
1913 0x9e, 0xa7, 0xf3, 0x02, 0xfd, 0xca, 0xdf, 0x5a,
1914 0x1f, 0x71, 0xb6, 0x26, 0x09, 0x24, 0x39, 0xda,
1915 0xc0, 0xde, 0x2a, 0x0e, 0xcd, 0x1f, 0xe5, 0xb6,
1916 0x4f, 0x82, 0xa0, 0xa9, 0x90, 0xd3, 0xd9, 0x6a,
1917 0x43, 0x14, 0x2a, 0xf7, 0xac, 0xd5, 0xa0, 0x54,
1918 0x93, 0xc4, 0xb9, 0xe7, 0x24, 0x84, 0x4d, 0x69,
1919 0x5e, 0xcc, 0x2a, 0x32, 0xb5, 0xfb, 0xe4, 0xb4,
1920 0x08, 0xd5, 0x36, 0x58, 0x59, 0x40, 0xfb, 0x29,
1921 0x7f, 0xa7, 0x17, 0x25, 0xc4, 0x0d, 0x78, 0x37,
1922 0x04, 0x8c, 0x49, 0x92
1924 static BYTE abEncryptedMessage[12] = {
1925 0x40, 0x64, 0x28, 0xe8, 0x8a, 0xe7, 0xa4, 0xd4,
1926 0x1c, 0xfd, 0xde, 0x71
1939 dwLen = (
DWORD)
sizeof(abSessionKey);
1945 dwLen =
sizeof(
DWORD);
1950 broken(dwVal == 0xffffffff),
1951 "expected CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_DECRYPT|CRYPT_ENCRYPT,"
1952 " got %08x\n", dwVal);
1954 dwLen = (
DWORD)
sizeof(abEncryptedMessage);
1957 ok(dwLen == 12,
"expected 12, got %d\n", dwLen);
1958 ok(!
memcmp(abEncryptedMessage,
"Wine rocks!", 12),
"decrypt failed\n");
1963 dwLen = (
DWORD)
sizeof(abSessionKey);
1969 dwLen = (
DWORD)
sizeof(abSessionKey);
1985 ok(
result,
"CryptImportKey failed at size %d: %d (%08x)\n", dwLen,
1995 BYTE abData[] =
"Wine rocks!";
1997 BYTE abPubKey[148] = {
1998 0x06, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00,
1999 0x52, 0x53, 0x41, 0x31, 0x00, 0x04, 0x00, 0x00,
2000 0x01, 0x00, 0x01, 0x00, 0x71, 0x64, 0x9f, 0x19,
2001 0x89, 0x1c, 0x21, 0xcc, 0x36, 0xa3, 0xc9, 0x27,
2002 0x08, 0x8a, 0x09, 0xc6, 0xbe, 0xeb, 0xd3, 0xf8,
2003 0x19, 0xa9, 0x92, 0x57, 0xe4, 0xb9, 0x5d, 0xda,
2004 0x88, 0x93, 0xe4, 0x6b, 0x38, 0x77, 0x14, 0x8a,
2005 0x96, 0xc0, 0xb6, 0x4e, 0x42, 0xf5, 0x01, 0xdc,
2006 0xf0, 0xeb, 0x3c, 0xc7, 0x7b, 0xc4, 0xfd, 0x7c,
2007 0xde, 0x93, 0x34, 0x0a, 0x92, 0xe5, 0x97, 0x9c,
2008 0x3e, 0x65, 0xb8, 0x91, 0x2f, 0xe3, 0xf3, 0x89,
2009 0xcd, 0x6c, 0x26, 0xa4, 0x6c, 0xc7, 0x6d, 0x0b,
2010 0x2c, 0xa2, 0x0b, 0x29, 0xe2, 0xfc, 0x30, 0xfa,
2011 0x20, 0xdb, 0x4c, 0xb8, 0x91, 0xb8, 0x69, 0x63,
2012 0x96, 0x41, 0xc2, 0xb4, 0x60, 0xeb, 0xcd, 0xff,
2013 0x3a, 0x1f, 0x94, 0xb1, 0x23, 0xcf, 0x0f, 0x49,
2014 0xad, 0xd5, 0x33, 0x85, 0x71, 0xaf, 0x12, 0x87,
2015 0x84, 0xef, 0xa0, 0xea, 0xe1, 0xc1, 0xd4, 0xc7,
2016 0xe1, 0x21, 0x50, 0xac
2019 BYTE abSignatureMD2[128] = {
2020 0x4a, 0x4e, 0xb7, 0x5e, 0x32, 0xda, 0xdb, 0x67,
2021 0x9f, 0x77, 0x84, 0x32, 0x00, 0xba, 0x5f, 0x6b,
2022 0x0d, 0xcf, 0xd9, 0x99, 0xbd, 0x96, 0x31, 0xda,
2023 0x23, 0x4c, 0xd9, 0x4a, 0x90, 0x84, 0x20, 0x59,
2024 0x51, 0xdc, 0xd4, 0x93, 0x3a, 0xae, 0x0a, 0x0a,
2025 0xa1, 0x76, 0xfa, 0xb5, 0x68, 0xee, 0xc7, 0x34,
2026 0x41, 0xd3, 0xe7, 0x5a, 0x0e, 0x22, 0x61, 0x40,
2027 0xea, 0x24, 0x56, 0xf1, 0x91, 0x5a, 0xf7, 0xa7,
2028 0x5b, 0xf4, 0x98, 0x6b, 0xc3, 0xef, 0xad, 0xc0,
2029 0x5e, 0x6b, 0x87, 0x76, 0xcb, 0x1f, 0x62, 0x06,
2030 0x7c, 0xf6, 0x48, 0x97, 0x81, 0x8d, 0xef, 0x51,
2031 0x51, 0xdc, 0x21, 0x91, 0x57, 0x1e, 0x79, 0x6f,
2032 0x49, 0xb5, 0xde, 0x31, 0x07, 0x45, 0x99, 0x46,
2033 0xc3, 0x4f, 0xca, 0x2d, 0x0e, 0x4c, 0x10, 0x25,
2034 0xcb, 0x1a, 0x98, 0x63, 0x41, 0x93, 0x47, 0xc0,
2035 0xb2, 0xbc, 0x10, 0x3c, 0xe7, 0xd4, 0x3c, 0x1e
2038 BYTE abSignatureMD2NoOID[128] = {
2039 0x0c, 0x21, 0x3e, 0x60, 0xf9, 0xd0, 0x36, 0x2d,
2040 0xe1, 0x10, 0x45, 0x45, 0x85, 0x03, 0x29, 0x19,
2041 0xef, 0x19, 0xd9, 0xa6, 0x7e, 0x9c, 0x0d, 0xbd,
2042 0x03, 0x0e, 0xb9, 0x51, 0x9e, 0x74, 0x79, 0xc4,
2043 0xde, 0x25, 0xf2, 0x35, 0x74, 0x55, 0xbc, 0x65,
2044 0x7e, 0x33, 0x28, 0xa8, 0x1e, 0x72, 0xaa, 0x99,
2045 0xdd, 0xf5, 0x26, 0x20, 0x29, 0xf8, 0xa6, 0xdf,
2046 0x28, 0x4b, 0x1c, 0xdb, 0xa1, 0x41, 0x56, 0xbc,
2047 0xf9, 0x9c, 0x66, 0xc0, 0x37, 0x41, 0x55, 0xa0,
2048 0xe2, 0xec, 0xbf, 0x71, 0xf0, 0x5d, 0x25, 0x01,
2049 0x75, 0x91, 0xe2, 0x81, 0xb2, 0x9f, 0x57, 0xa7,
2050 0x5c, 0xd2, 0xfa, 0x66, 0xdb, 0x71, 0x2b, 0x1f,
2051 0xad, 0x30, 0xde, 0xea, 0x49, 0x73, 0x30, 0x6a,
2052 0x22, 0x54, 0x49, 0x4e, 0xae, 0xf6, 0x88, 0xc9,
2053 0xff, 0x71, 0xba, 0xbf, 0x27, 0xc5, 0xfa, 0x06,
2054 0xe2, 0x91, 0x71, 0x8a, 0x7e, 0x0c, 0xc2, 0x07
2057 BYTE abSignatureMD4[128] = {
2058 0x1c, 0x78, 0xaa, 0xea, 0x74, 0xf4, 0x83, 0x51,
2059 0xae, 0x66, 0xe3, 0xa9, 0x1c, 0x03, 0x39, 0x1b,
2060 0xac, 0x7e, 0x4e, 0x85, 0x7e, 0x1c, 0x38, 0xd2,
2061 0x82, 0x43, 0xb3, 0x6f, 0x6f, 0x46, 0x45, 0x8e,
2062 0x17, 0x74, 0x58, 0x29, 0xca, 0xe1, 0x03, 0x13,
2063 0x45, 0x79, 0x34, 0xdf, 0x5c, 0xd6, 0xc3, 0xf9,
2064 0x7a, 0x1c, 0x9d, 0xff, 0x6f, 0x03, 0x7d, 0x0f,
2065 0x59, 0x1a, 0x2d, 0x0e, 0x94, 0xb4, 0x75, 0x96,
2066 0xd1, 0x48, 0x63, 0x6e, 0xb2, 0xc4, 0x5c, 0xd9,
2067 0xab, 0x49, 0xb4, 0x90, 0xd9, 0x57, 0x04, 0x6e,
2068 0x4c, 0xb6, 0xea, 0x00, 0x94, 0x4a, 0x34, 0xa0,
2069 0xd9, 0x63, 0xef, 0x2c, 0xde, 0x5b, 0xb9, 0xbe,
2070 0x35, 0xc8, 0xc1, 0x31, 0xb5, 0x31, 0x15, 0x18,
2071 0x90, 0x39, 0xf5, 0x2a, 0x34, 0x6d, 0xb4, 0xab,
2072 0x09, 0x34, 0x69, 0x54, 0x4d, 0x11, 0x2f, 0xf3,
2073 0xa2, 0x36, 0x0e, 0xa8, 0x45, 0xe7, 0x36, 0xac
2076 BYTE abSignatureMD4NoOID[128] = {
2077 0xd3, 0x60, 0xb2, 0xb0, 0x22, 0x0a, 0x99, 0xda,
2078 0x04, 0x85, 0x64, 0xc6, 0xc6, 0xdb, 0x11, 0x24,
2079 0xe9, 0x68, 0x2d, 0xf7, 0x09, 0xef, 0xb6, 0xa0,
2080 0xa2, 0xfe, 0x45, 0xee, 0x85, 0x49, 0xcd, 0x36,
2081 0xf7, 0xc7, 0x9d, 0x2b, 0x4c, 0x68, 0xda, 0x85,
2082 0x8c, 0x50, 0xcc, 0x4f, 0x4b, 0xe1, 0x82, 0xc3,
2083 0xbe, 0xa3, 0xf1, 0x78, 0x6b, 0x60, 0x42, 0x3f,
2084 0x67, 0x22, 0x14, 0xe4, 0xe1, 0xa4, 0x6e, 0xa9,
2085 0x4e, 0xf1, 0xd4, 0xb0, 0xce, 0x82, 0xac, 0x06,
2086 0xba, 0x2c, 0xbc, 0xf7, 0xcb, 0xf6, 0x0c, 0x3f,
2087 0xf6, 0x79, 0xfe, 0xb3, 0xd8, 0x5a, 0xbc, 0xdb,
2088 0x05, 0x41, 0xa4, 0x07, 0x57, 0x9e, 0xa2, 0x96,
2089 0xfc, 0x60, 0x4b, 0xf7, 0x6f, 0x86, 0x26, 0x1f,
2090 0xc2, 0x2c, 0x67, 0x08, 0xcd, 0x7f, 0x91, 0xe9,
2091 0x16, 0xb5, 0x0e, 0xd9, 0xc4, 0xc4, 0x97, 0xeb,
2092 0x91, 0x3f, 0x20, 0x6c, 0xf0, 0x68, 0x86, 0x7f
2095 BYTE abSignatureMD5[128] = {
2096 0x4f, 0xe0, 0x8c, 0x9b, 0x43, 0xdd, 0x02, 0xe5,
2097 0xf4, 0xa1, 0xdd, 0x88, 0x4c, 0x9c, 0x40, 0x0f,
2098 0x6c, 0x43, 0x86, 0x64, 0x00, 0xe6, 0xac, 0xf7,
2099 0xd0, 0x92, 0xaa, 0xc4, 0x62, 0x9a, 0x48, 0x98,
2100 0x1a, 0x56, 0x6d, 0x75, 0xec, 0x04, 0x89, 0xec,
2101 0x69, 0x93, 0xd6, 0x61, 0x37, 0xb2, 0x36, 0xb5,
2102 0xb2, 0xba, 0xf2, 0xf5, 0x21, 0x0c, 0xf1, 0x04,
2103 0xc8, 0x2d, 0xf5, 0xa0, 0x8d, 0x6d, 0x10, 0x0b,
2104 0x68, 0x63, 0xf2, 0x08, 0x68, 0xdc, 0xbd, 0x95,
2105 0x25, 0x7d, 0xee, 0x63, 0x5c, 0x3b, 0x98, 0x4c,
2106 0xea, 0x41, 0xdc, 0x6a, 0x8b, 0x6c, 0xbb, 0x29,
2107 0x2b, 0x1c, 0x5c, 0x8b, 0x7d, 0x94, 0x24, 0xa9,
2108 0x7a, 0x62, 0x94, 0xf3, 0x3a, 0x6a, 0xb2, 0x4c,
2109 0x33, 0x59, 0x00, 0xcd, 0x7d, 0x37, 0x79, 0x90,
2110 0x31, 0xd1, 0xd9, 0x84, 0x12, 0xe5, 0x08, 0x5e,
2111 0xb3, 0x60, 0x61, 0x27, 0x78, 0x37, 0x63, 0x01
2114 BYTE abSignatureMD5NoOID[128] = {
2115 0xc6, 0xad, 0x5c, 0x2b, 0x9b, 0xe0, 0x99, 0x2f,
2116 0x5e, 0x55, 0x04, 0x32, 0x65, 0xe0, 0xb5, 0x75,
2117 0x01, 0x9a, 0x11, 0x4d, 0x0e, 0x9a, 0xe1, 0x9f,
2118 0xc7, 0xbf, 0x77, 0x6d, 0xa9, 0xfd, 0xcc, 0x9d,
2119 0x8b, 0xd1, 0x31, 0xed, 0x5a, 0xd2, 0xe5, 0x5f,
2120 0x42, 0x3b, 0xb5, 0x3c, 0x32, 0x30, 0x88, 0x49,
2121 0xcb, 0x67, 0xb8, 0x2e, 0xc9, 0xf5, 0x2b, 0xc8,
2122 0x35, 0x71, 0xb5, 0x1b, 0x32, 0x3f, 0x44, 0x4c,
2123 0x66, 0x93, 0xcb, 0xe8, 0x48, 0x7c, 0x14, 0x23,
2124 0xfb, 0x12, 0xa5, 0xb7, 0x86, 0x94, 0x6b, 0x19,
2125 0x17, 0x20, 0xc6, 0xb8, 0x09, 0xe8, 0xbb, 0xdb,
2126 0x00, 0x2b, 0x96, 0x4a, 0x93, 0x00, 0x26, 0xd3,
2127 0x07, 0xa0, 0x06, 0xce, 0x5a, 0x13, 0x69, 0x6b,
2128 0x62, 0x5a, 0x56, 0x61, 0x6a, 0xd8, 0x11, 0x3b,
2129 0xd5, 0x67, 0xc7, 0x4d, 0xf6, 0x66, 0x63, 0xc5,
2130 0xe3, 0x8f, 0x7c, 0x7c, 0xb1, 0x3e, 0x55, 0x43
2133 BYTE abSignatureSHA[128] = {
2134 0x5a, 0x4c, 0x66, 0xc9, 0x30, 0x67, 0xcb, 0x91,
2135 0x3c, 0x4d, 0xd5, 0x8d, 0xea, 0x4e, 0x85, 0xcd,
2136 0xd9, 0x68, 0x3a, 0xf3, 0x24, 0x3c, 0x99, 0x24,
2137 0x25, 0x32, 0x93, 0x3d, 0xd6, 0x2f, 0x86, 0x94,
2138 0x23, 0x09, 0xee, 0x02, 0xd4, 0x15, 0xdc, 0x5f,
2139 0x0e, 0x44, 0x45, 0x13, 0x5f, 0x18, 0x5d, 0x1a,
2140 0xd7, 0x0b, 0xd1, 0x23, 0xd6, 0x35, 0x98, 0x52,
2141 0x57, 0x45, 0x74, 0x92, 0xe3, 0x50, 0xb4, 0x20,
2142 0x28, 0x2a, 0x11, 0xbf, 0x49, 0xb4, 0x2c, 0xc5,
2143 0xd4, 0x1a, 0x27, 0x4e, 0xdf, 0xa0, 0xb5, 0x7a,
2144 0xc8, 0x14, 0xdd, 0x9b, 0xb6, 0xca, 0xd6, 0xff,
2145 0xb2, 0x6b, 0xd8, 0x98, 0x67, 0x80, 0xab, 0x53,
2146 0x52, 0xbb, 0xe1, 0x2a, 0xce, 0x79, 0x2f, 0x00,
2147 0x53, 0x26, 0xd8, 0xa7, 0x43, 0xca, 0x72, 0x0e,
2148 0x68, 0x97, 0x37, 0x71, 0x87, 0xc2, 0x6a, 0x98,
2149 0xbb, 0x6c, 0xa0, 0x01, 0xff, 0x04, 0x9d, 0xa6
2152 BYTE abSignatureSHANoOID[128] = {
2153 0x86, 0xa6, 0x2b, 0x9a, 0x04, 0xda, 0x47, 0xc6,
2154 0x4f, 0x97, 0x8a, 0x8a, 0xf4, 0xfa, 0x63, 0x1a,
2155 0x32, 0x89, 0x56, 0x41, 0x37, 0x91, 0x15, 0x2f,
2156 0x2d, 0x1c, 0x8f, 0xdc, 0x88, 0x40, 0xbb, 0x37,
2157 0x3e, 0x06, 0x33, 0x1b, 0xde, 0xda, 0x7c, 0x65,
2158 0x91, 0x35, 0xca, 0x45, 0x17, 0x0e, 0x24, 0xbe,
2159 0x9e, 0xf6, 0x4e, 0x8a, 0xa4, 0x3e, 0xca, 0xe6,
2160 0x11, 0x36, 0xb8, 0x3a, 0xf0, 0xde, 0x71, 0xfe,
2161 0xdd, 0xb3, 0xcb, 0x6c, 0x39, 0xe0, 0x5f, 0x0c,
2162 0x9e, 0xa8, 0x40, 0x26, 0x9c, 0x81, 0xe9, 0xc4,
2163 0x15, 0x90, 0xbf, 0x4f, 0xd2, 0xc1, 0xa1, 0x80,
2164 0x52, 0xfd, 0xf6, 0x3d, 0x99, 0x1b, 0x9c, 0x8a,
2165 0x27, 0x1b, 0x0c, 0x9a, 0xf3, 0xf9, 0xa2, 0x00,
2166 0x3e, 0x5b, 0xdf, 0xc2, 0xb4, 0x71, 0xa5, 0xbd,
2167 0xf8, 0xae, 0x63, 0xbb, 0x4a, 0xc9, 0xdd, 0x67,
2168 0xc1, 0x3e, 0x93, 0xee, 0xf1, 0x1f, 0x24, 0x5b
2186 "Expected ERROR_INVALID_PARAMETER error, got %08x\n",
GetLastError());
2194 "Expected NTE_BAD_SIGNATURE, got %08x\n",
GetLastError());
2282 BYTE abData[2048] =
"Wine rocks!";
2300 ok(dwLen == 128,
"Unexpected length %d\n", dwLen);
2319 dwLen =
sizeof(abData) - (20 * 2 + 2) + 1;
2327 memcpy(abData,
"Wine rocks!", dwLen);
2336 memcpy(abData,
"Wine rocks!", 12);
2349 memcpy(abData,
"Wine rocks!", dwLen);
2356 dwLen =
sizeof(
DWORD);
2361 broken(dwVal == 0xffffffff),
2362 "expected CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_DECRYPT|CRYPT_ENCRYPT,"
2363 " got %08x\n", dwVal);
2368 "expected NTE_BAD_KEY or NTE_NOT_FOUND, got %08x\n",
GetLastError());
2378 "expected NTE_BAD_KEY_STATE, got %08x\n",
GetLastError());
2385 "expected NTE_BAD_DATA or NTE_BAD_FLAGS, got %08x\n",
GetLastError());
2395 dwLen =
sizeof(
DWORD);
2400 broken(dwVal == 0xffffffff),
2401 "expected CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_DECRYPT|CRYPT_ENCRYPT,"
2402 " got %08x\n", dwVal);
2412 "expected NTE_BAD_KEY_STATE, got %08x\n",
GetLastError());
2419 "expected NTE_BAD_DATA or NTE_BAD_FLAGS, got %08x\n",
GetLastError());
2430 DWORD dwLen, dwDataLen, dwVal;
2434 BYTE emptyKey[2048], *exported_key, *exported_key2;
2435 static BYTE abPlainPublicKey[84] = {
2436 0x06, 0x02, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00,
2437 0x52, 0x53, 0x41, 0x31, 0x00, 0x02, 0x00, 0x00,
2438 0x01, 0x00, 0x01, 0x00, 0x11, 0x11, 0x11, 0x11,
2439 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
2440 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
2441 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
2442 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
2443 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
2444 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
2445 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
2446 0x11, 0x11, 0x11, 0x11
2448 static BYTE priv_key_with_high_bit[] = {
2449 0x07, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00,
2450 0x52, 0x53, 0x41, 0x32, 0x00, 0x04, 0x00, 0x00,
2451 0x01, 0x00, 0x01, 0x00, 0xd5, 0xa2, 0x0d, 0x66,
2452 0xfe, 0x65, 0xb5, 0xf1, 0xc9, 0x6b, 0xf5, 0x58,
2453 0x04, 0x38, 0x2d, 0xf4, 0xa3, 0x5a, 0xda, 0x9e,
2454 0x95, 0x81, 0x85, 0x3d, 0x01, 0x07, 0xb2, 0x03,
2455 0x77, 0x70, 0x79, 0x6e, 0x6c, 0x26, 0x42, 0xa4,
2456 0x12, 0xfd, 0xaa, 0x29, 0x83, 0x04, 0xce, 0x91,
2457 0x90, 0x39, 0x5e, 0x49, 0x56, 0xfd, 0x0a, 0xe5,
2458 0xb1, 0xea, 0x3b, 0xb2, 0x70, 0xb0, 0x20, 0xc1,
2459 0x1f, 0x22, 0x07, 0x3e, 0x4d, 0xc0, 0x73, 0xfd,
2460 0x92, 0x8f, 0x87, 0xd8, 0xd1, 0xd1, 0x28, 0xd8,
2461 0x19, 0xd1, 0x93, 0x83, 0xe0, 0xb8, 0x9f, 0x53,
2462 0xf4, 0x6a, 0x7c, 0xcb, 0x10, 0x53, 0xd0, 0x37,
2463 0x02, 0xb4, 0xa5, 0xf7, 0xa2, 0x28, 0x6e, 0x26,
2464 0xef, 0x5c, 0x14, 0x01, 0x40, 0x1e, 0xa3, 0xe1,
2465 0xda, 0x76, 0xd0, 0x12, 0x84, 0xb7, 0x48, 0x7d,
2466 0xc8, 0x67, 0x5c, 0xb2, 0xd5, 0x2e, 0xaf, 0x8e,
2467 0x7d, 0x32, 0x59, 0x92, 0x01, 0xd6, 0x5b, 0x68,
2468 0x28, 0x9b, 0xb1, 0x6c, 0x69, 0xeb, 0x61, 0x5b,
2469 0x4b, 0x13, 0xe2, 0xbd, 0x7d, 0xbe, 0xce, 0xe8,
2470 0x41, 0x54, 0xca, 0xa8, 0xdd, 0xc7, 0xfe, 0x8b,
2471 0xdf, 0xf6, 0x55, 0x6c, 0x50, 0x11, 0xc8, 0x15,
2472 0x13, 0x42, 0x59, 0x9f, 0xbb, 0xea, 0x73, 0x78,
2473 0x7b, 0x22, 0x8d, 0x96, 0x62, 0xe5, 0xda, 0xa2,
2474 0x85, 0x5c, 0x20, 0x74, 0x9f, 0x1c, 0x12, 0xf2,
2475 0x48, 0x06, 0x1a, 0xc6, 0xd5, 0x94, 0xec, 0x31,
2476 0x6b, 0xb6, 0x7b, 0x54, 0x61, 0x77, 0xec, 0x7c,
2477 0x6f, 0xb7, 0x55, 0x3d, 0x6b, 0x98, 0x05, 0xd7,
2478 0x8a, 0x73, 0x25, 0xf2, 0x8f, 0xe4, 0xb8, 0x8d,
2479 0x27, 0x18, 0x0d, 0x05, 0xba, 0x23, 0x54, 0x37,
2480 0x10, 0xf0, 0x1c, 0x41, 0xa6, 0xae, 0x4c, 0x2a,
2481 0x6a, 0x2f, 0x7f, 0x68, 0x43, 0x86, 0xe7, 0x9c,
2482 0xfd, 0x9e, 0xf1, 0xfe, 0x84, 0xe3, 0xb6, 0x99,
2483 0x51, 0xfe, 0x1e, 0xbd, 0x01, 0xc6, 0x10, 0xef,
2484 0x88, 0xa4, 0xd8, 0x53, 0x14, 0x88, 0x15, 0xc9,
2485 0xe5, 0x86, 0xe2, 0x8d, 0x85, 0x2e, 0x0d, 0xec,
2486 0x15, 0xa7, 0x48, 0xfa, 0x18, 0xfb, 0x01, 0x8d,
2487 0x2b, 0x90, 0x70, 0x7f, 0x78, 0xb1, 0x33, 0x7e,
2488 0xfe, 0x82, 0x40, 0x5f, 0x4a, 0x97, 0xc2, 0x42,
2489 0x22, 0xd5, 0x5f, 0xbc, 0xbd, 0xab, 0x26, 0x98,
2490 0xcd, 0xb5, 0xdf, 0x7e, 0xa0, 0x68, 0xa7, 0x12,
2491 0x9e, 0xa5, 0xa2, 0x90, 0x85, 0xc5, 0xca, 0x73,
2492 0x4a, 0x59, 0x8a, 0xec, 0xcf, 0xdd, 0x65, 0x5d,
2493 0xc1, 0xaa, 0x86, 0x53, 0xd5, 0xde, 0xbb, 0x23,
2494 0x24, 0xb8, 0x9b, 0x74, 0x03, 0x20, 0xb4, 0xf0,
2495 0xe4, 0xdd, 0xd2, 0x03, 0xfd, 0x67, 0x55, 0x19,
2496 0x28, 0x1d, 0xc1, 0xb8, 0xa5, 0x89, 0x0e, 0xc0,
2497 0x80, 0x9d, 0xdd, 0xda, 0x9d, 0x30, 0x5c, 0xc8,
2498 0xbb, 0xfe, 0x8f, 0xce, 0xd5, 0xf6, 0xdf, 0xfa,
2499 0x14, 0xaf, 0xe4, 0xba, 0xb0, 0x84, 0x45, 0xd8,
2500 0x67, 0xa7, 0xd0, 0xce, 0x89, 0x2a, 0x30, 0x8c,
2501 0xfa, 0xe9, 0x65, 0xa4, 0x21, 0x2d, 0x6b, 0xa2,
2502 0x9b, 0x8f, 0x92, 0xbd, 0x3a, 0x10, 0x71, 0x12,
2503 0xc2, 0x02, 0x3d, 0xd5, 0x83, 0x1d, 0xfa, 0x42,
2504 0xb7, 0x48, 0x1b, 0x31, 0xe3, 0x82, 0x90, 0x2d,
2505 0x91, 0x59, 0xf9, 0x38, 0x52, 0xe5, 0xdb, 0xc1,
2506 0x4d, 0x3a, 0xe6, 0x9b, 0x6a, 0xbb, 0xea, 0xa4,
2507 0x8d, 0x5e, 0xc4, 0x00, 0x01, 0xb8, 0xec, 0x91,
2508 0xc1, 0xdb, 0x63, 0xbd, 0x57, 0xb6, 0x26, 0x15,
2509 0xb6, 0x3e, 0xa2, 0xdf, 0x62, 0x8d, 0xa8, 0xbe,
2510 0xe1, 0xf1, 0x39, 0xbd, 0x18, 0xd2, 0x6f, 0xd7,
2511 0xda, 0xdc, 0x71, 0x30, 0xf1, 0x21, 0x71, 0xa4,
2512 0x08, 0x43, 0x46, 0xdf, 0x50, 0xbd, 0x3c, 0x60,
2513 0x5b, 0x63, 0x35, 0xe3, 0x37, 0x5b, 0x25, 0x17,
2514 0x54, 0x5e, 0x68, 0x60, 0xb6, 0x49, 0xef, 0x6e,
2515 0x09, 0xef, 0xda, 0x90, 0x3e, 0xd4, 0x09, 0x33,
2516 0x36, 0x57, 0x9a, 0x14, 0xbd, 0xf7, 0xb1, 0x98,
2517 0x30, 0x42, 0x03, 0x84, 0x61, 0xeb, 0x8e, 0x50,
2518 0xdc, 0x6a, 0x93, 0x1b, 0x32, 0x51, 0xf9, 0xc6,
2519 0xc2, 0x19, 0xb3, 0x5d, 0xe2, 0xf8, 0xc5, 0x8f,
2520 0x68, 0xaa, 0x1d, 0xdb, 0xd3, 0x7f, 0x8d, 0x98,
2521 0x9c, 0x16, 0x8c, 0xc3, 0xcd, 0xd9, 0xdb, 0x08,
2522 0xe6, 0x36, 0x60, 0xb6, 0x36, 0xdc, 0x1d, 0x59,
2523 0xb6, 0x5f, 0x01, 0x5e
2525 static const BYTE expected_exported_priv_key[] = {
2526 0x07, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00,
2527 0x52, 0x53, 0x41, 0x32, 0x00, 0x04, 0x00, 0x00,
2528 0x01, 0x00, 0x01, 0x00, 0xd5, 0xa2, 0x0d, 0x66,
2529 0xfe, 0x65, 0xb5, 0xf1, 0xc9, 0x6b, 0xf5, 0x58,
2530 0x04, 0x38, 0x2d, 0xf4, 0xa3, 0x5a, 0xda, 0x9e,
2531 0x95, 0x81, 0x85, 0x3d, 0x01, 0x07, 0xb2, 0x03,
2532 0x77, 0x70, 0x79, 0x6e, 0x6c, 0x26, 0x42, 0xa4,
2533 0x12, 0xfd, 0xaa, 0x29, 0x83, 0x04, 0xce, 0x91,
2534 0x90, 0x39, 0x5e, 0x49, 0x56, 0xfd, 0x0a, 0xe5,
2535 0xb1, 0xea, 0x3b, 0xb2, 0x70, 0xb0, 0x20, 0xc1,
2536 0x1f, 0x22, 0x07, 0x3e, 0x4d, 0xc0, 0x73, 0xfd,
2537 0x92, 0x8f, 0x87, 0xd8, 0xd1, 0xd1, 0x28, 0xd8,
2538 0x19, 0xd1, 0x93, 0x83, 0xe0, 0xb8, 0x9f, 0x53,
2539 0xf4, 0x6a, 0x7c, 0xcb, 0x10, 0x53, 0xd0, 0x37,
2540 0x02, 0xb4, 0xa5, 0xf7, 0xa2, 0x28, 0x6e, 0x26,
2541 0xef, 0x5c, 0x14, 0x01, 0x40, 0x1e, 0xa3, 0xe1,
2542 0xda, 0x76, 0xd0, 0x12, 0x84, 0xb7, 0x48, 0x7d,
2543 0xc8, 0x67, 0x5c, 0xb2, 0xd5, 0x2e, 0xaf, 0x8e,
2544 0x7d, 0x32, 0x59, 0x92, 0x01, 0xd6, 0x5b, 0x68,
2545 0x28, 0x9b, 0xb1, 0x6c, 0x69, 0xeb, 0x61, 0x5b,
2546 0x4b, 0x13, 0xe2, 0xbd, 0x7d, 0xbe, 0xce, 0xe8,
2547 0x41, 0x54, 0xca, 0xa8, 0xdd, 0xc7, 0xfe, 0x8b,
2548 0xdf, 0xf6, 0x55, 0x6c, 0x50, 0x11, 0xc8, 0x15,
2549 0x13, 0x42, 0x59, 0x9f, 0xbb, 0xea, 0x73, 0x78,
2550 0x7b, 0x22, 0x8d, 0x96, 0x62, 0xe5, 0xda, 0xa2,
2551 0x85, 0x5c, 0x20, 0x74, 0x9f, 0x1c, 0x12, 0xf2,
2552 0x48, 0x06, 0x1a, 0xc6, 0xd5, 0x94, 0xec, 0x31,
2553 0x6b, 0xb6, 0x7b, 0x54, 0x61, 0x77, 0xec, 0x7c,
2554 0x6f, 0xb7, 0x55, 0x3d, 0x6b, 0x98, 0x05, 0xd7,
2555 0x8a, 0x73, 0x25, 0xf2, 0x8f, 0xe4, 0xb8, 0x8d,
2556 0x27, 0x18, 0x0d, 0x05, 0xba, 0x23, 0x54, 0x37,
2557 0x10, 0xf0, 0x1c, 0x41, 0xa6, 0xae, 0x4c, 0x2a,
2558 0x6a, 0x2f, 0x7f, 0x68, 0x43, 0x86, 0xe7, 0x9c,
2559 0xfd, 0x9e, 0xf1, 0xfe, 0x84, 0xe3, 0xb6, 0x99,
2560 0x51, 0xfe, 0x1e, 0xbd, 0x01, 0xc6, 0x10, 0xef,
2561 0x88, 0xa4, 0xd8, 0x53, 0x14, 0x88, 0x15, 0xc9,
2562 0xe5, 0x86, 0xe2, 0x8d, 0x85, 0x2e, 0x0d, 0xec,
2563 0x15, 0xa7, 0x48, 0xfa, 0x18, 0xfb, 0x01, 0x8d,
2564 0x2b, 0x90, 0x70, 0x7f, 0x78, 0xb1, 0x33, 0x7e,
2565 0xfe, 0x82, 0x40, 0x5f, 0x4a, 0x97, 0xc2, 0x42,
2566 0x22, 0xd5, 0x5f, 0xbc, 0xbd, 0xab, 0x26, 0x98,
2567 0xcd, 0xb5, 0xdf, 0x7e, 0xa0, 0x68, 0xa7, 0x12,
2568 0x9e, 0xa5, 0xa2, 0x90, 0x85, 0xc5, 0xca, 0x73,
2569 0x4a, 0x59, 0x8a, 0xec, 0xcf, 0xdd, 0x65, 0x5d,
2570 0xc1, 0xaa, 0x86, 0x53, 0xd5, 0xde, 0xbb, 0x23,
2571 0x24, 0xb8, 0x9b, 0x74, 0x03, 0x20, 0xb4, 0xf0,
2572 0xe4, 0xdd, 0xd2, 0x03, 0xfd, 0x67, 0x55, 0x19,
2573 0x28, 0x1d, 0xc1, 0xb8, 0xa5, 0x89, 0x0e, 0xc0,
2574 0x80, 0x9d, 0xdd, 0xda, 0x9d, 0x30, 0x5c, 0xc8,
2575 0xbb, 0xfe, 0x8f, 0xce, 0xd5, 0xf6, 0xdf, 0xfa,
2576 0x14, 0xaf, 0xe4, 0xba, 0xb0, 0x84, 0x45, 0xd8,
2577 0x67, 0xa7, 0xd0, 0xce, 0x89, 0x2a, 0x30, 0x8c,
2578 0xfa, 0xe9, 0x65, 0xa4, 0x21, 0x2d, 0x6b, 0xa2,
2579 0x9b, 0x8f, 0x92, 0xbd, 0x3a, 0x10, 0x71, 0x12,
2580 0xc2, 0x02, 0x3d, 0xd5, 0x83, 0x1d, 0xfa, 0x42,
2581 0xb7, 0x48, 0x1b, 0x31, 0xe3, 0x82, 0x90, 0x2d,
2582 0x91, 0x59, 0xf9, 0x38, 0x52, 0xe5, 0xdb, 0xc1,
2583 0x4d, 0x3a, 0xe6, 0x9b, 0x6a, 0xbb, 0xea, 0xa4,
2584 0x8d, 0x5e, 0xc4, 0x00, 0x01, 0xb8, 0xec, 0x91,
2585 0xc1, 0xdb, 0x63, 0xbd, 0x57, 0xb6, 0x26, 0x15,
2586 0xb6, 0x3e, 0xa2, 0xdf, 0x62, 0x8d, 0xa8, 0xbe,
2587 0xe1, 0xf1, 0x39, 0xbd, 0x18, 0xd2, 0x6f, 0xd7,
2588 0xda, 0xdc, 0x71, 0x30, 0xf1, 0x21, 0x71, 0xa4,
2589 0x08, 0x43, 0x46, 0xdf, 0x50, 0xbd, 0x3c, 0x60,
2590 0x5b, 0x63, 0x35, 0xe3, 0x37, 0x5b, 0x25, 0x17,
2591 0x54, 0x5e, 0x68, 0x60, 0xb6, 0x49, 0xef, 0x6e,
2592 0x09, 0xef, 0xda, 0x90, 0x3e, 0xd4, 0x09, 0x33,
2593 0x36, 0x57, 0x9a, 0x14, 0xbd, 0xf7, 0xb1, 0x98,
2594 0x30, 0x42, 0x03, 0x84, 0x61, 0xeb, 0x8e, 0x50,
2595 0xdc, 0x6a, 0x93, 0x1b, 0x32, 0x51, 0xf9, 0xc6,
2596 0xc2, 0x19, 0xb3, 0x5d, 0xe2, 0xf8, 0xc5, 0x8f,
2597 0x68, 0xaa, 0x1d, 0xdb, 0xd3, 0x7f, 0x8d, 0x98,
2598 0x9c, 0x16, 0x8c, 0xc3, 0xcd, 0xd9, 0xdb, 0x08,
2599 0xe6, 0x36, 0x60, 0xb6, 0x36, 0xdc, 0x1d, 0x59,
2600 0xb6, 0x5f, 0x01, 0x5e
2605 ok(
result,
"failed to import the public key\n");
2607 dwDataLen=
sizeof(algID);
2609 ok(
result,
"failed to get the KP_ALGID from the imported public key\n");
2610 ok(algID ==
CALG_RSA_KEYX,
"Expected CALG_RSA_KEYX, got %x\n", algID);
2613 dwDataLen =
sizeof(
DWORD);
2618 broken(dwVal == 0xffffffff),
2619 "expected CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_DECRYPT|CRYPT_ENCRYPT,"
2620 " got %08x\n", dwVal);
2622 ok(
result,
"failed to export the fresh imported public key\n");
2623 ok(dwLen == 84,
"Expected exported key to be 84 bytes long but got %d bytes.\n",dwLen);
2624 ok(!
memcmp(emptyKey, abPlainPublicKey, dwLen),
"exported key is different from the imported key\n");
2640 ok(dwDataLen ==
sizeof(expected_exported_priv_key),
"unexpected size %d\n",
2642 ok(!
memcmp(exported_key, expected_exported_priv_key, dwDataLen),
2643 "unexpected value\n");
2673 result = !
memcmp(exported_key, exported_key2, dwDataLen);
2676 trace(
"Expected public key (%u):\n", dwDataLen);
2678 trace(
"AT_KEYEXCHANGE public key (%u):\n", dwDataLen);
2685 sizeof(abPlainPublicKey), 0, 0, &hPublicKey);
2686 ok(
result,
"failed to import the public key\n");
2700 result = !
memcmp(exported_key, exported_key2, dwDataLen);
2703 trace(
"Expected public key (%u):\n", dwDataLen);
2705 trace(
"AT_KEYEXCHANGE public key (%u):\n", dwDataLen);
2716 static const struct rfc2202_test_case {
2720 const DWORD data_len;
2723 {
"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
2724 "\x0b\x0b\x0b\x0b", 20,
2726 "\xb6\x17\x31\x86\x55\x05\x72\x64\xe2\x8b\xc0\xb6\xfb\x37\x8c\x8e"
2727 "\xf1\x46\xbe\x00" },
2729 "what do ya want for nothing?", 28,
2730 "\xef\xfc\xdf\x6a\xe5\xeb\x2f\xa2\xd2\x74\x16\xd5\xf1\x84\xdf\x9c"
2731 "\x25\x9a\x7c\x79" },
2732 {
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
2733 "\xaa\xaa\xaa\xaa", 20,
2734 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
2735 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
2736 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
2738 "\x12\x5d\x73\x42\xb9\xac\x11\xcd\x91\xa3\x9a\xf4\x8a\xa1\x7b\x4f"
2739 "\x63\xf1\x75\xd3" },
2740 {
"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
2741 "\x11\x12\x13\x14\x15\x16\x17\x18\x19", 25,
2742 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
2743 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
2744 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
2746 "\x4c\x90\x07\xF4\x02\x62\x50\xc6\xbc\x84\x14\xf9\xbf\x50\xc8\x6c"
2747 "\x2d\x72\x35\xda" },
2748 {
"\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c"
2749 "\x0c\x0c\x0c\x0c", 20,
2750 "Test With Truncation", 20,
2751 "\x4c\x1a\x03\x42\x4b\x55\xe0\x7f\xe7\xf2\x7b\xe1\xd5\x8b\xb9\x32"
2752 "\x4a\x9a\x5a\x04" },
2753 {
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
2754 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
2755 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
2756 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
2757 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
2759 "Test Using Larger Than Block-Size Key - Hash Key First", 54,
2760 "\xaa\x4a\xe5\xe1\x52\x72\xd0\x0e\x95\x70\x56\x37\xce\x8a\x3b\x55"
2761 "\xed\x40\x21\x12" },
2762 {
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
2763 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
2764 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
2765 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
2766 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
2768 "Test Using Larger Than Block-Size Key and Larger "
2769 "Than One Block-Size Data", 73,
2770 "\xe8\xe9\x9D\x0f\x45\x23\x7d\x78\x6d\x6b\xba\xa7\x96\x5c\x78\x08"
2771 "\xbb\xff\x1a\x91" }
2777 const struct rfc2202_test_case *test_case = &cases[
i];
2785 BYTE *key_bytes = (
BYTE *)(key_len + 1);
2793 *key_len = test_case->key_len;
2794 memcpy(key_bytes, test_case->key, *key_len);
2810 digest_size =
sizeof(digest);
2813 ok(!
memcmp(digest, test_case->digest,
sizeof(digest)),
"Unexpected value on test case %d\n",
i);
2825 HCRYPTKEY hRSAKey, hMasterSecret, hServerWriteKey, hServerWriteMACKey;
2832 BYTE abTLS1Master[140] = {
2833 0x01, 0x02, 0x00, 0x00, 0x06, 0x4c, 0x00, 0x00,
2834 0x00, 0xa4, 0x00, 0x00, 0x5b, 0x13, 0xc7, 0x68,
2835 0xd8, 0x55, 0x23, 0x5d, 0xbc, 0xa6, 0x9d, 0x97,
2836 0x0e, 0xcd, 0x6b, 0xcf, 0xc0, 0xdc, 0xc5, 0x53,
2837 0x28, 0xa0, 0xca, 0xc1, 0x63, 0x4e, 0x3a, 0x24,
2838 0x22, 0xe5, 0x4d, 0x15, 0xbb, 0xa5, 0x06, 0xc3,
2839 0x98, 0x25, 0xdc, 0x35, 0xd3, 0xdb, 0xab, 0xb8,
2840 0x44, 0x1b, 0xfe, 0x63, 0x88, 0x7c, 0x2e, 0x6d,
2841 0x34, 0xd9, 0x0f, 0x7e, 0x2f, 0xc2, 0xb2, 0x6e,
2842 0x56, 0xfa, 0xab, 0xb2, 0x88, 0xf6, 0x15, 0x6e,
2843 0xa8, 0xcd, 0x70, 0x16, 0x94, 0x61, 0x07, 0x40,
2844 0x9e, 0x25, 0x22, 0xf8, 0x64, 0x9f, 0xcc, 0x0b,
2845 0xf1, 0x92, 0x4d, 0xfe, 0xc3, 0x5d, 0x52, 0xdb,
2846 0x0f, 0xff, 0x12, 0x0f, 0x49, 0x43, 0x7d, 0xc6,
2847 0x52, 0x61, 0xb0, 0x06, 0xc8, 0x1b, 0x90, 0xac,
2848 0x09, 0x7e, 0x4b, 0x95, 0x69, 0x3b, 0x0d, 0x41,
2849 0x1b, 0x4c, 0x65, 0x75, 0x4d, 0x85, 0x16, 0xc4,
2850 0xd3, 0x1e, 0x82, 0xb3
2852 BYTE abServerSecret[33] =
"Super Secret Server Secret 12345";
2853 BYTE abClientSecret[33] =
"Super Secret Client Secret 12345";
2854 BYTE abHashedHandshakes[37] =
"123456789012345678901234567890123456";
2855 BYTE abClientFinished[16] =
"client finished";
2856 BYTE abData[16] =
"Wine rocks!";
2858 static const BYTE abEncryptedData[16] = {
2859 0x13, 0xd2, 0xdd, 0xeb, 0x6c, 0x3f, 0xbe, 0xb2,
2860 0x04, 0x86, 0xb5, 0xe5, 0x08, 0xe5, 0xf3, 0x0d
2862 static const BYTE abPRF[16] = {
2863 0xa8, 0xb2, 0xa6, 0xef, 0x83, 0x4e, 0x74, 0xb1,
2864 0xf3, 0xb1, 0x51, 0x5a, 0x1a, 0x2b, 0x11, 0x31
2866 static const BYTE abMD5[16] = {
2867 0xe1, 0x65, 0x3f, 0xdb, 0xbb, 0x3d, 0x99, 0x3c,
2868 0x3d, 0xca, 0x6a, 0x6f, 0xfa, 0x15, 0x4e, 0xaa
2874 win_skip(
"no PROV_RSA_SCHANNEL support\n");
2893 dwLen = (
DWORD)
sizeof(abTLS1Master);
2905 "expected ERROR_INVALID_PARAMETER, got %08x\n",
GetLastError());
2910 data_blob.
pbData = abClientSecret;
2916 data_blob.
pbData = abServerSecret;
2927 win_skip(
"Broken TLS1 hash creation\n");
2946 saSChannelAlg.
cBits = 64;
2955 saSChannelAlg.
cBits = 128;
2983 data_blob.
pbData = abHashedHandshakes;
2989 data_blob.
pbData = abClientFinished;
2995 dwLen = (
DWORD)
sizeof(abData);
3018 dwLen = (
DWORD)
sizeof(abMD5Hash);
3039 static const char test_string[] =
"Well this is a fine how-do-you-do.";
3044 DWORD dataLen, keyLen;
3089 ok(dataLen ==
sizeof(
test_string),
"unexpected size %d\n", dataLen);
3112 "Expected dwBufferLen to be (MAX_PATH + 1), it was : %d\n", dwBufferLen);
3115 dwBufferLen = (
DWORD)
sizeof(abContainerName);
3121 if (!
strcmp((
const char*)abContainerName,
"winetest")) fFound =
TRUE;
3122 dwBufferLen = (
DWORD)
sizeof(abContainerName);
31290x07,0x02,0x00,0x00,0x00,0x24,0x00,0x00,0x52,0x53,0x41,0x32,0x00,0x02,0x00,0x00,
31300x01,0x00,0x01,0x00,0xf1,0x82,0x9e,0x84,0xb5,0x79,0x9a,0xbe,0x4d,0x06,0x20,0x21,
31310xb1,0x89,0x0c,0xca,0xb0,0x35,0x72,0x18,0xc6,0x92,0xa8,0xe2,0xb1,0xe1,0xf6,0x56,
31320x53,0x99,0x47,0x10,0x6e,0x1c,0x81,0xaf,0xb8,0xf9,0x5f,0xfe,0x76,0x7f,0x2c,0x93,
31330xec,0x54,0x7e,0x5e,0xc2,0x25,0x3c,0x50,0x56,0x10,0x20,0x72,0x4a,0x93,0x03,0x12,
31340x29,0x98,0xcc,0xc9,0x47,0xbf,0xbf,0x93,0xcc,0xb0,0xe5,0x53,0x14,0xc8,0x7e,0x1f,
31350xa4,0x03,0x2d,0x8e,0x84,0x7a,0xd2,0xeb,0xf7,0x92,0x5e,0xa2,0xc7,0x6b,0x35,0x7d,
31360xcb,0x60,0xae,0xfb,0x07,0x78,0x11,0x73,0xb5,0x79,0xe5,0x7e,0x96,0xe3,0x50,0x95,
31370x80,0x0e,0x1c,0xf6,0x56,0xc6,0xe9,0x0a,0xaf,0x03,0xc6,0xdc,0x9a,0x81,0xcf,0x7a,
31380x63,0x16,0x43,0xcd,0xab,0x74,0xa1,0x7d,0xe7,0xe0,0x75,0x6d,0xbd,0x19,0xae,0x0b,
31390xa3,0x7f,0x6a,0x7b,0x05,0x4e,0xbc,0xec,0x18,0xfc,0x19,0xc2,0x00,0xf0,0x6a,0x2e,
31400xc4,0x31,0x73,0xba,0x07,0xcc,0x9d,0x57,0xeb,0xc7,0x7c,0x00,0x7d,0x5d,0x11,0x16,
31410x42,0x4b,0xe5,0x3a,0xf5,0xc7,0xf8,0xee,0xc3,0x2c,0x0d,0x86,0x03,0xe2,0xaf,0xb2,
31420xd2,0x91,0xdb,0x71,0xcd,0xdf,0x81,0x5f,0x06,0xfc,0x48,0x0d,0xb6,0x88,0x9f,0xc1,
31430x5e,0x24,0xa2,0x05,0x4f,0x30,0x2e,0x8f,0x8b,0x0d,0x76,0xa1,0x84,0xda,0x7b,0x44,
31440x70,0x85,0xf1,0x50,0xb1,0x21,0x3d,0xe2,0x57,0x3d,0xd0,0x01,0x93,0x49,0x8e,0xc5,
31450x0b,0x8b,0x0d,0x7b,0x08,0xe9,0x14,0xec,0x20,0x0d,0xea,0x02,0x00,0x63,0xe8,0x0a,
31460x52,0xe8,0xfb,0x21,0xbd,0x37,0xde,0x4c,0x4d,0xc2,0xf6,0xb9,0x0d,0x2a,0xc3,0xe2,
31470xc9,0xdf,0x48,0x3e,0x55,0x3d,0xe3,0xc0,0x22,0x37,0xf9,0x52,0xc0,0xd7,0x61,0x22,
31480xb6,0x85,0x86,0x07 };
3155 DWORD keySpec, dataLen,dwParam;
3160 "Expected NTE_BAD_PROV_TYPE, got %08x\n",
GetLastError());
3163 "Expected ERROR_INVALID_PARAMETER or NTE_BAD_KEYSET, got %08x\n",
GetLastError());
3167 "Expected ERROR_INVALID_PARAMETER or NTE_BAD_KEYSET, got %08x\n",
GetLastError());
3171 "Expected NTE_BAD_KEYSET, got %08x\n",
GetLastError());
3174 "Expected NTE_BAD_KEYSET, got %08x\n",
GetLastError());
3183 "Expected NTE_BAD_KEYSET, got %08x\n",
GetLastError());
3189 dataLen =
sizeof(keySpec);
3193 "Expected AT_KEYEXCHANGE | AT_SIGNATURE, got %08x\n", keySpec);
3223 "Expected NTE_BAD_KEYSET, got %08x\n",
GetLastError());
3233 dataLen =
sizeof(dwParam);
3236 "Expected PROV_RSA_FULL, got 0x%08X\n",dwParam);
3237 dataLen =
sizeof(dwParam);
3239 ok(
result && dataLen ==
sizeof(dwParam) && dwParam == 0,
3240 "Expected 0, got 0x%08X\n",dwParam);
3241 dataLen =
sizeof(dwParam);
3244 "Expected CRYPT_SEC_DESCR to be set, got 0x%08X\n",dwParam);
3245 dataLen =
sizeof(keySpec);
3249 skip(
"PP_KEYSPEC is not supported (win9x or NT)\n");
3252 "Expected AT_KEYEXCHANGE | AT_SIGNATURE, got %08x\n", keySpec);
3254 dataLen =
sizeof(
szName);
3257 "failed getting PP_CONTAINER. result = %s. Error 0x%08X. returned length = %d\n",
3260 dataLen =
sizeof(
szName);
3265 skip(
"PP_UNIQUE_CONTAINER is not supported (win9x or NT)\n");
3277 "Expected a param length of 70, got %d\n", dataLen);
3280 "Wrong container name : %s\n",
szName);