1c2c66affSColin Finck /*
2c2c66affSColin Finck  * Unit test suite for cryptui.dll
3c2c66affSColin Finck  *
4c2c66affSColin Finck  * Copyright 2008 Juan Lang
5c2c66affSColin Finck  *
6c2c66affSColin Finck  * This library is free software; you can redistribute it and/or
7c2c66affSColin Finck  * modify it under the terms of the GNU Lesser General Public
8c2c66affSColin Finck  * License as published by the Free Software Foundation; either
9c2c66affSColin Finck  * version 2.1 of the License, or (at your option) any later version.
10c2c66affSColin Finck  *
11c2c66affSColin Finck  * This library is distributed in the hope that it will be useful,
12c2c66affSColin Finck  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13c2c66affSColin Finck  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14c2c66affSColin Finck  * Lesser General Public License for more details.
15c2c66affSColin Finck  *
16c2c66affSColin Finck  * You should have received a copy of the GNU Lesser General Public
17c2c66affSColin Finck  * License along with this library; if not, write to the Free Software
18c2c66affSColin Finck  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19c2c66affSColin Finck  */
20c2c66affSColin Finck #include <stdarg.h>
21*e4bb5d08SAmine Khaldi #include <stdio.h>
22c2c66affSColin Finck #define NONAMELESSUNION
23c2c66affSColin Finck #include <windef.h>
24c2c66affSColin Finck #include <winbase.h>
25*e4bb5d08SAmine Khaldi #include <winerror.h>
26c2c66affSColin Finck #include <winuser.h>
27*e4bb5d08SAmine Khaldi #include <wincrypt.h>
28c2c66affSColin Finck #include <cryptuiapi.h>
29c2c66affSColin Finck 
30*e4bb5d08SAmine Khaldi #include "wine/test.h"
31c2c66affSColin Finck 
32c2c66affSColin Finck static BYTE v1CertWithValidPubKey[] = {
33c2c66affSColin Finck 0x30,0x81,0xcf,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x15,0x31,0x13,0x30,
34c2c66affSColin Finck 0x11,0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,
35c2c66affSColin Finck 0x6e,0x67,0x00,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,
36c2c66affSColin Finck 0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,
37c2c66affSColin Finck 0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x15,0x31,0x13,0x30,0x11,
38c2c66affSColin Finck 0x06,0x03,0x55,0x04,0x03,0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,
39c2c66affSColin Finck 0x67,0x00,0x30,0x5c,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,
40c2c66affSColin Finck 0x01,0x01,0x05,0x00,0x03,0x4b,0x00,0x30,0x48,0x02,0x41,0x00,0xe2,0x54,0x3a,
41c2c66affSColin Finck 0xa7,0x83,0xb1,0x27,0x14,0x3e,0x59,0xbb,0xb4,0x53,0xe6,0x1f,0xe7,0x5d,0xf1,
42c2c66affSColin Finck 0x21,0x68,0xad,0x85,0x53,0xdb,0x6b,0x1e,0xeb,0x65,0x97,0x03,0x86,0x60,0xde,
43c2c66affSColin Finck 0xf3,0x6c,0x38,0x75,0xe0,0x4c,0x61,0xbb,0xbc,0x62,0x17,0xa9,0xcd,0x79,0x3f,
44c2c66affSColin Finck 0x21,0x4e,0x96,0xcb,0x0e,0xdc,0x61,0x94,0x30,0x18,0x10,0x6b,0xd0,0x1c,0x10,
45c2c66affSColin Finck 0x79,0x02,0x03,0x01,0x00,0x01,0xa3,0x16,0x30,0x14,0x30,0x12,0x06,0x03,0x55,
46c2c66affSColin Finck 0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02,0x01,0x01 };
47c2c66affSColin Finck static const BYTE iTunesCert1[] = {
48c2c66affSColin Finck 0x30,0x82,0x03,0xff,0x30,0x82,0x02,0xe7,0xa0,0x03,0x02,0x01,0x02,0x02,0x10,
49c2c66affSColin Finck 0x0d,0xe9,0x2b,0xf0,0xd4,0xd8,0x29,0x88,0x18,0x32,0x05,0x09,0x5e,0x9a,0x76,
50c2c66affSColin Finck 0x88,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x05,
51c2c66affSColin Finck 0x00,0x30,0x53,0x31,0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,
52c2c66affSColin Finck 0x53,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0a,0x13,0x0e,0x56,0x65,0x72,
53c2c66affSColin Finck 0x69,0x53,0x69,0x67,0x6e,0x2c,0x20,0x49,0x6e,0x63,0x2e,0x31,0x2b,0x30,0x29,
54c2c66affSColin Finck 0x06,0x03,0x55,0x04,0x03,0x13,0x22,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6e,
55c2c66affSColin Finck 0x20,0x54,0x69,0x6d,0x65,0x20,0x53,0x74,0x61,0x6d,0x70,0x69,0x6e,0x67,0x20,
56c2c66affSColin Finck 0x53,0x65,0x72,0x76,0x69,0x63,0x65,0x73,0x20,0x43,0x41,0x30,0x1e,0x17,0x0d,
57c2c66affSColin Finck 0x30,0x33,0x31,0x32,0x30,0x34,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x17,0x0d,
58c2c66affSColin Finck 0x30,0x38,0x31,0x32,0x30,0x33,0x32,0x33,0x35,0x39,0x35,0x39,0x5a,0x30,0x57,
59c2c66affSColin Finck 0x31,0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x17,
60c2c66affSColin Finck 0x30,0x15,0x06,0x03,0x55,0x04,0x0a,0x13,0x0e,0x56,0x65,0x72,0x69,0x53,0x69,
61c2c66affSColin Finck 0x67,0x6e,0x2c,0x20,0x49,0x6e,0x63,0x2e,0x31,0x2f,0x30,0x2d,0x06,0x03,0x55,
62c2c66affSColin Finck 0x04,0x03,0x13,0x26,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6e,0x20,0x54,0x69,
63c2c66affSColin Finck 0x6d,0x65,0x20,0x53,0x74,0x61,0x6d,0x70,0x69,0x6e,0x67,0x20,0x53,0x65,0x72,
64c2c66affSColin Finck 0x76,0x69,0x63,0x65,0x73,0x20,0x53,0x69,0x67,0x6e,0x65,0x72,0x30,0x82,0x01,
65c2c66affSColin Finck 0x22,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01,0x05,
66c2c66affSColin Finck 0x00,0x03,0x82,0x01,0x0f,0x00,0x30,0x82,0x01,0x0a,0x02,0x82,0x01,0x01,0x00,
67c2c66affSColin Finck 0xb2,0x50,0x28,0x48,0xdd,0xd3,0x68,0x7a,0x84,0x18,0x44,0x66,0x75,0x5d,0x7e,
68c2c66affSColin Finck 0xc4,0xb8,0x9f,0x63,0x26,0xff,0x3d,0x43,0x9c,0x7c,0x11,0x38,0x10,0x25,0x55,
69c2c66affSColin Finck 0x73,0xd9,0x75,0x27,0x69,0xfd,0x4e,0xb9,0x20,0x5c,0xd3,0x0a,0xf9,0xa0,0x1b,
70c2c66affSColin Finck 0x2a,0xed,0x55,0x56,0x21,0x61,0xd8,0x1e,0xdb,0xe4,0xbc,0x33,0x6b,0xc7,0xef,
71c2c66affSColin Finck 0xdd,0xa3,0x37,0x65,0x8e,0x1b,0x93,0x0c,0xb6,0x53,0x1e,0x5c,0x7c,0x66,0x35,
72c2c66affSColin Finck 0x5f,0x05,0x8a,0x45,0xfe,0x76,0x4e,0xdf,0x53,0x80,0xa2,0x81,0x20,0x9d,0xae,
73c2c66affSColin Finck 0x88,0x5c,0xa2,0x08,0xf7,0xe5,0x30,0xf9,0xee,0x22,0x37,0x4c,0x42,0x0a,0xce,
74c2c66affSColin Finck 0xdf,0xc6,0x1f,0xc4,0xd6,0x55,0xe9,0x81,0x3f,0xb5,0x52,0xa3,0x2c,0xaa,0x01,
75c2c66affSColin Finck 0x7a,0xf2,0xa2,0xaa,0x8d,0x35,0xfe,0x9f,0xe6,0x5d,0x6a,0x05,0x9f,0x3d,0x6b,
76c2c66affSColin Finck 0xe3,0xbf,0x96,0xc0,0xfe,0xcc,0x60,0xf9,0x40,0xe7,0x07,0xa0,0x44,0xeb,0x81,
77c2c66affSColin Finck 0x51,0x6e,0xa5,0x2a,0xf2,0xb6,0x8a,0x10,0x28,0xed,0x8f,0xdc,0x06,0xa0,0x86,
78c2c66affSColin Finck 0x50,0x9a,0x7b,0x4a,0x08,0x0d,0x30,0x1d,0xca,0x10,0x9e,0x6b,0xf7,0xe9,0x58,
79c2c66affSColin Finck 0xae,0x04,0xa9,0x40,0x99,0xb2,0x28,0xe8,0x8f,0x16,0xac,0x3c,0xe3,0x53,0x6f,
80c2c66affSColin Finck 0x4b,0xd3,0x35,0x9d,0xb5,0x6f,0x64,0x1d,0xb3,0x96,0x2c,0xbb,0x3d,0xe7,0x79,
81c2c66affSColin Finck 0xeb,0x6d,0x7a,0xf9,0x16,0xe6,0x26,0xad,0xaf,0xef,0x99,0x53,0xb7,0x40,0x2c,
82c2c66affSColin Finck 0x95,0xb8,0x79,0xaa,0xfe,0xd4,0x52,0xab,0x29,0x74,0x7e,0x42,0xec,0x39,0x1e,
83c2c66affSColin Finck 0xa2,0x6a,0x16,0xe6,0x59,0xbb,0x24,0x68,0xd8,0x00,0x80,0x43,0x10,0x87,0x80,
84c2c66affSColin Finck 0x6b,0x02,0x03,0x01,0x00,0x01,0xa3,0x81,0xca,0x30,0x81,0xc7,0x30,0x34,0x06,
85c2c66affSColin Finck 0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x01,0x01,0x04,0x28,0x30,0x26,0x30,0x24,
86c2c66affSColin Finck 0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x01,0x86,0x18,0x68,0x74,0x74,
87c2c66affSColin Finck 0x70,0x3a,0x2f,0x2f,0x6f,0x63,0x73,0x70,0x2e,0x76,0x65,0x72,0x69,0x73,0x69,
88c2c66affSColin Finck 0x67,0x6e,0x2e,0x63,0x6f,0x6d,0x30,0x0c,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,
89c2c66affSColin Finck 0xff,0x04,0x02,0x30,0x00,0x30,0x33,0x06,0x03,0x55,0x1d,0x1f,0x04,0x2c,0x30,
90c2c66affSColin Finck 0x2a,0x30,0x28,0xa0,0x26,0xa0,0x24,0x86,0x22,0x68,0x74,0x74,0x70,0x3a,0x2f,
91c2c66affSColin Finck 0x2f,0x63,0x72,0x6c,0x2e,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6e,0x2e,0x63,
92c2c66affSColin Finck 0x6f,0x6d,0x2f,0x74,0x73,0x73,0x2d,0x63,0x61,0x2e,0x63,0x72,0x6c,0x30,0x16,
93c2c66affSColin Finck 0x06,0x03,0x55,0x1d,0x25,0x01,0x01,0xff,0x04,0x0c,0x30,0x0a,0x06,0x08,0x2b,
94c2c66affSColin Finck 0x06,0x01,0x05,0x05,0x07,0x03,0x08,0x30,0x0e,0x06,0x03,0x55,0x1d,0x0f,0x01,
95c2c66affSColin Finck 0x01,0xff,0x04,0x04,0x03,0x02,0x06,0xc0,0x30,0x24,0x06,0x03,0x55,0x1d,0x11,
96c2c66affSColin Finck 0x04,0x1d,0x30,0x1b,0xa4,0x19,0x30,0x17,0x31,0x15,0x30,0x13,0x06,0x03,0x55,
97c2c66affSColin Finck 0x04,0x03,0x13,0x0c,0x54,0x53,0x41,0x32,0x30,0x34,0x38,0x2d,0x31,0x2d,0x35,
98c2c66affSColin Finck 0x34,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x05,
99c2c66affSColin Finck 0x00,0x03,0x82,0x01,0x01,0x00,0x87,0x78,0x70,0xda,0x4e,0x52,0x01,0x20,0x5b,
100c2c66affSColin Finck 0xe0,0x79,0xc9,0x82,0x30,0xc4,0xfd,0xb9,0x19,0x96,0xbd,0x91,0x00,0xc3,0xbd,
101c2c66affSColin Finck 0xcd,0xcd,0xc6,0xf4,0x0e,0xd8,0xff,0xf9,0x4d,0xc0,0x33,0x62,0x30,0x11,0xc5,
102c2c66affSColin Finck 0xf5,0x74,0x1b,0xd4,0x92,0xde,0x5f,0x9c,0x20,0x13,0xb1,0x7c,0x45,0xbe,0x50,
103c2c66affSColin Finck 0xcd,0x83,0xe7,0x80,0x17,0x83,0xa7,0x27,0x93,0x67,0x13,0x46,0xfb,0xca,0xb8,
104c2c66affSColin Finck 0x98,0x41,0x03,0xcc,0x9b,0x51,0x5b,0x05,0x8b,0x7f,0xa8,0x6f,0xf3,0x1b,0x50,
105c2c66affSColin Finck 0x1b,0x24,0x2e,0xf2,0x69,0x8d,0x6c,0x22,0xf7,0xbb,0xca,0x16,0x95,0xed,0x0c,
106c2c66affSColin Finck 0x74,0xc0,0x68,0x77,0xd9,0xeb,0x99,0x62,0x87,0xc1,0x73,0x90,0xf8,0x89,0x74,
107c2c66affSColin Finck 0x7a,0x23,0xab,0xa3,0x98,0x7b,0x97,0xb1,0xf7,0x8f,0x29,0x71,0x4d,0x2e,0x75,
108c2c66affSColin Finck 0x1b,0x48,0x41,0xda,0xf0,0xb5,0x0d,0x20,0x54,0xd6,0x77,0xa0,0x97,0x82,0x63,
109c2c66affSColin Finck 0x69,0xfd,0x09,0xcf,0x8a,0xf0,0x75,0xbb,0x09,0x9b,0xd9,0xf9,0x11,0x55,0x26,
110c2c66affSColin Finck 0x9a,0x61,0x32,0xbe,0x7a,0x02,0xb0,0x7b,0x86,0xbe,0xa2,0xc3,0x8b,0x22,0x2c,
111c2c66affSColin Finck 0x78,0xd1,0x35,0x76,0xbc,0x92,0x73,0x5c,0xf9,0xb9,0xe6,0x4c,0x15,0x0a,0x23,
112c2c66affSColin Finck 0xcc,0xe4,0xd2,0xd4,0x34,0x2e,0x49,0x40,0x15,0x3c,0x0f,0x60,0x7a,0x24,0xc6,
113c2c66affSColin Finck 0xa5,0x66,0xef,0x96,0xcf,0x70,0xeb,0x3e,0xe7,0xf4,0x0d,0x7e,0xdc,0xd1,0x7c,
114c2c66affSColin Finck 0xa3,0x76,0x71,0x69,0xc1,0x9c,0x4f,0x47,0x30,0x35,0x21,0xb1,0xa2,0xaf,0x1a,
115c2c66affSColin Finck 0x62,0x3c,0x2b,0xd9,0x8e,0xaa,0x2a,0x07,0x7b,0xd8,0x18,0xb3,0x5c,0x7b,0xe2,
116c2c66affSColin Finck 0x9d,0xa5,0x6f,0xfe,0x3c,0x89,0xad };
117c2c66affSColin Finck static const BYTE iTunesCert2[] = {
118c2c66affSColin Finck 0x30,0x82,0x04,0xbf,0x30,0x82,0x04,0x28,0xa0,0x03,0x02,0x01,0x02,0x02,0x10,
119c2c66affSColin Finck 0x41,0x91,0xa1,0x5a,0x39,0x78,0xdf,0xcf,0x49,0x65,0x66,0x38,0x1d,0x4c,0x75,
120c2c66affSColin Finck 0xc2,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x05,
121c2c66affSColin Finck 0x00,0x30,0x5f,0x31,0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,
122c2c66affSColin Finck 0x53,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0a,0x13,0x0e,0x56,0x65,0x72,
123c2c66affSColin Finck 0x69,0x53,0x69,0x67,0x6e,0x2c,0x20,0x49,0x6e,0x63,0x2e,0x31,0x37,0x30,0x35,
124c2c66affSColin Finck 0x06,0x03,0x55,0x04,0x0b,0x13,0x2e,0x43,0x6c,0x61,0x73,0x73,0x20,0x33,0x20,
125c2c66affSColin Finck 0x50,0x75,0x62,0x6c,0x69,0x63,0x20,0x50,0x72,0x69,0x6d,0x61,0x72,0x79,0x20,
126c2c66affSColin Finck 0x43,0x65,0x72,0x74,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x41,
127c2c66affSColin Finck 0x75,0x74,0x68,0x6f,0x72,0x69,0x74,0x79,0x30,0x1e,0x17,0x0d,0x30,0x34,0x30,
128c2c66affSColin Finck 0x37,0x31,0x36,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x17,0x0d,0x31,0x34,0x30,
129c2c66affSColin Finck 0x37,0x31,0x35,0x32,0x33,0x35,0x39,0x35,0x39,0x5a,0x30,0x81,0xb4,0x31,0x0b,
130c2c66affSColin Finck 0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x17,0x30,0x15,
131c2c66affSColin Finck 0x06,0x03,0x55,0x04,0x0a,0x13,0x0e,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6e,
132c2c66affSColin Finck 0x2c,0x20,0x49,0x6e,0x63,0x2e,0x31,0x1f,0x30,0x1d,0x06,0x03,0x55,0x04,0x0b,
133c2c66affSColin Finck 0x13,0x16,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6e,0x20,0x54,0x72,0x75,0x73,
134c2c66affSColin Finck 0x74,0x20,0x4e,0x65,0x74,0x77,0x6f,0x72,0x6b,0x31,0x3b,0x30,0x39,0x06,0x03,
135c2c66affSColin Finck 0x55,0x04,0x0b,0x13,0x32,0x54,0x65,0x72,0x6d,0x73,0x20,0x6f,0x66,0x20,0x75,
136c2c66affSColin Finck 0x73,0x65,0x20,0x61,0x74,0x20,0x68,0x74,0x74,0x70,0x73,0x3a,0x2f,0x2f,0x77,
137c2c66affSColin Finck 0x77,0x77,0x2e,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6e,0x2e,0x63,0x6f,0x6d,
138c2c66affSColin Finck 0x2f,0x72,0x70,0x61,0x20,0x28,0x63,0x29,0x30,0x34,0x31,0x2e,0x30,0x2c,0x06,
139c2c66affSColin Finck 0x03,0x55,0x04,0x03,0x13,0x25,0x56,0x65,0x72,0x69,0x53,0x69,0x67,0x6e,0x20,
140c2c66affSColin Finck 0x43,0x6c,0x61,0x73,0x73,0x20,0x33,0x20,0x43,0x6f,0x64,0x65,0x20,0x53,0x69,
141c2c66affSColin Finck 0x67,0x6e,0x69,0x6e,0x67,0x20,0x32,0x30,0x30,0x34,0x20,0x43,0x41,0x30,0x82,
142c2c66affSColin Finck 0x01,0x22,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01,
143c2c66affSColin Finck 0x05,0x00,0x03,0x82,0x01,0x0f,0x00,0x30,0x82,0x01,0x0a,0x02,0x82,0x01,0x01,
144c2c66affSColin Finck 0x00,0xbe,0xbc,0xee,0xbc,0x7e,0xef,0x83,0xeb,0xe0,0x37,0x4f,0xfb,0x03,0x10,
145c2c66affSColin Finck 0x38,0xbe,0x08,0xd2,0x8c,0x7d,0x9d,0xfa,0x92,0x7f,0x19,0x0c,0xc2,0x6b,0xee,
146c2c66affSColin Finck 0x42,0x52,0x8c,0xde,0xd3,0x1c,0x48,0x13,0x25,0xea,0xc1,0x63,0x7a,0xf9,0x51,
147c2c66affSColin Finck 0x65,0xee,0xd3,0xaa,0x3b,0xf5,0xf0,0x94,0x9c,0x2b,0xfb,0xf2,0x66,0xd4,0x24,
148c2c66affSColin Finck 0xda,0xf7,0xf5,0x9f,0x6e,0x19,0x39,0x36,0xbc,0xd0,0xa3,0x76,0x08,0x1e,0x22,
149c2c66affSColin Finck 0x27,0x24,0x6c,0x38,0x91,0x27,0xe2,0x84,0x49,0xae,0x1b,0x8a,0xa1,0xfd,0x25,
150c2c66affSColin Finck 0x82,0x2c,0x10,0x30,0xe8,0x71,0xab,0x28,0xe8,0x77,0x4a,0x51,0xf1,0xec,0xcd,
151c2c66affSColin Finck 0xf8,0xf0,0x54,0xd4,0x6f,0xc0,0xe3,0x6d,0x0a,0x8f,0xd9,0xd8,0x64,0x8d,0x63,
152c2c66affSColin Finck 0xb2,0x2d,0x4e,0x27,0xf6,0x85,0x0e,0xfe,0x6d,0xe3,0x29,0x99,0xe2,0x85,0x47,
153c2c66affSColin Finck 0x7c,0x2d,0x86,0x7f,0xe8,0x57,0x8f,0xad,0x67,0xc2,0x33,0x32,0x91,0x13,0x20,
154c2c66affSColin Finck 0xfc,0xa9,0x23,0x14,0x9a,0x6d,0xc2,0x84,0x4b,0x76,0x68,0x04,0xd5,0x71,0x2c,
155c2c66affSColin Finck 0x5d,0x21,0xfa,0x88,0x0d,0x26,0xfd,0x1f,0x2d,0x91,0x2b,0xe7,0x01,0x55,0x4d,
156c2c66affSColin Finck 0xf2,0x6d,0x35,0x28,0x82,0xdf,0xd9,0x6b,0x5c,0xb6,0xd6,0xd9,0xaa,0x81,0xfd,
157c2c66affSColin Finck 0x5f,0xcd,0x83,0xba,0x63,0x9d,0xd0,0x22,0xfc,0xa9,0x3b,0x42,0x69,0xb2,0x8e,
158c2c66affSColin Finck 0x3a,0xb5,0xbc,0xb4,0x9e,0x0f,0x5e,0xc4,0xea,0x2c,0x82,0x8b,0x28,0xfd,0x53,
159c2c66affSColin Finck 0x08,0x96,0xdd,0xb5,0x01,0x20,0xd1,0xf9,0xa5,0x18,0xe7,0xc0,0xee,0x51,0x70,
160c2c66affSColin Finck 0x37,0xe1,0xb6,0x05,0x48,0x52,0x48,0x6f,0x38,0xea,0xc3,0xe8,0x6c,0x7b,0x44,
161c2c66affSColin Finck 0x84,0xbb,0x02,0x03,0x01,0x00,0x01,0xa3,0x82,0x01,0xa0,0x30,0x82,0x01,0x9c,
162c2c66affSColin Finck 0x30,0x12,0x06,0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,
163c2c66affSColin Finck 0x01,0xff,0x02,0x01,0x00,0x30,0x44,0x06,0x03,0x55,0x1d,0x20,0x04,0x3d,0x30,
164c2c66affSColin Finck 0x3b,0x30,0x39,0x06,0x0b,0x60,0x86,0x48,0x01,0x86,0xf8,0x45,0x01,0x07,0x17,
165c2c66affSColin Finck 0x03,0x30,0x2a,0x30,0x28,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x02,0x01,
166c2c66affSColin Finck 0x16,0x1c,0x68,0x74,0x74,0x70,0x73,0x3a,0x2f,0x2f,0x77,0x77,0x77,0x2e,0x76,
167c2c66affSColin Finck 0x65,0x72,0x69,0x73,0x69,0x67,0x6e,0x2e,0x63,0x6f,0x6d,0x2f,0x72,0x70,0x61,
168c2c66affSColin Finck 0x30,0x31,0x06,0x03,0x55,0x1d,0x1f,0x04,0x2a,0x30,0x28,0x30,0x26,0xa0,0x24,
169c2c66affSColin Finck 0xa0,0x22,0x86,0x20,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x63,0x72,0x6c,0x2e,
170c2c66affSColin Finck 0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6e,0x2e,0x63,0x6f,0x6d,0x2f,0x70,0x63,
171c2c66affSColin Finck 0x61,0x33,0x2e,0x63,0x72,0x6c,0x30,0x1d,0x06,0x03,0x55,0x1d,0x25,0x04,0x16,
172c2c66affSColin Finck 0x30,0x14,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x03,0x02,0x06,0x08,0x2b,
173c2c66affSColin Finck 0x06,0x01,0x05,0x05,0x07,0x03,0x03,0x30,0x0e,0x06,0x03,0x55,0x1d,0x0f,0x01,
174c2c66affSColin Finck 0x01,0xff,0x04,0x04,0x03,0x02,0x01,0x06,0x30,0x11,0x06,0x09,0x60,0x86,0x48,
175c2c66affSColin Finck 0x01,0x86,0xf8,0x42,0x01,0x01,0x04,0x04,0x03,0x02,0x00,0x01,0x30,0x29,0x06,
176c2c66affSColin Finck 0x03,0x55,0x1d,0x11,0x04,0x22,0x30,0x20,0xa4,0x1e,0x30,0x1c,0x31,0x1a,0x30,
177c2c66affSColin Finck 0x18,0x06,0x03,0x55,0x04,0x03,0x13,0x11,0x43,0x6c,0x61,0x73,0x73,0x33,0x43,
178c2c66affSColin Finck 0x41,0x32,0x30,0x34,0x38,0x2d,0x31,0x2d,0x34,0x33,0x30,0x1d,0x06,0x03,0x55,
179c2c66affSColin Finck 0x1d,0x0e,0x04,0x16,0x04,0x14,0x08,0xf5,0x51,0xe8,0xfb,0xfe,0x3d,0x3d,0x64,
180c2c66affSColin Finck 0x36,0x7c,0x68,0xcf,0x5b,0x78,0xa8,0xdf,0xb9,0xc5,0x37,0x30,0x81,0x80,0x06,
181c2c66affSColin Finck 0x03,0x55,0x1d,0x23,0x04,0x79,0x30,0x77,0xa1,0x63,0xa4,0x61,0x30,0x5f,0x31,
182c2c66affSColin Finck 0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x17,0x30,
183c2c66affSColin Finck 0x15,0x06,0x03,0x55,0x04,0x0a,0x13,0x0e,0x56,0x65,0x72,0x69,0x53,0x69,0x67,
184c2c66affSColin Finck 0x6e,0x2c,0x20,0x49,0x6e,0x63,0x2e,0x31,0x37,0x30,0x35,0x06,0x03,0x55,0x04,
185c2c66affSColin Finck 0x0b,0x13,0x2e,0x43,0x6c,0x61,0x73,0x73,0x20,0x33,0x20,0x50,0x75,0x62,0x6c,
186c2c66affSColin Finck 0x69,0x63,0x20,0x50,0x72,0x69,0x6d,0x61,0x72,0x79,0x20,0x43,0x65,0x72,0x74,
187c2c66affSColin Finck 0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x41,0x75,0x74,0x68,0x6f,
188c2c66affSColin Finck 0x72,0x69,0x74,0x79,0x82,0x10,0x70,0xba,0xe4,0x1d,0x10,0xd9,0x29,0x34,0xb6,
189c2c66affSColin Finck 0x38,0xca,0x7b,0x03,0xcc,0xba,0xbf,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,
190c2c66affSColin Finck 0xf7,0x0d,0x01,0x01,0x05,0x05,0x00,0x03,0x81,0x81,0x00,0xae,0x3a,0x17,0xb8,
191c2c66affSColin Finck 0x4a,0x7b,0x55,0xfa,0x64,0x55,0xec,0x40,0xa4,0xed,0x49,0x41,0x90,0x99,0x9c,
192c2c66affSColin Finck 0x89,0xbc,0xaf,0x2e,0x1d,0xca,0x78,0x23,0xf9,0x1c,0x19,0x0f,0x7f,0xeb,0x68,
193c2c66affSColin Finck 0xbc,0x32,0xd9,0x88,0x38,0xde,0xdc,0x3f,0xd3,0x89,0xb4,0x3f,0xb1,0x82,0x96,
194c2c66affSColin Finck 0xf1,0xa4,0x5a,0xba,0xed,0x2e,0x26,0xd3,0xde,0x7c,0x01,0x6e,0x00,0x0a,0x00,
195c2c66affSColin Finck 0xa4,0x06,0x92,0x11,0x48,0x09,0x40,0xf9,0x1c,0x18,0x79,0x67,0x23,0x24,0xe0,
196c2c66affSColin Finck 0xbb,0xd5,0xe1,0x50,0xae,0x1b,0xf5,0x0e,0xdd,0xe0,0x2e,0x81,0xcd,0x80,0xa3,
197c2c66affSColin Finck 0x6c,0x52,0x4f,0x91,0x75,0x55,0x8a,0xba,0x22,0xf2,0xd2,0xea,0x41,0x75,0x88,
198c2c66affSColin Finck 0x2f,0x63,0x55,0x7d,0x1e,0x54,0x5a,0x95,0x59,0xca,0xd9,0x34,0x81,0xc0,0x5f,
199c2c66affSColin Finck 0x5e,0xf6,0x7a,0xb5 };
200c2c66affSColin Finck static const BYTE iTunesCert3[] = {
201c2c66affSColin Finck 0x30,0x82,0x04,0xf1,0x30,0x82,0x03,0xd9,0xa0,0x03,0x02,0x01,0x02,0x02,0x10,
202c2c66affSColin Finck 0x0f,0x1a,0xa0,0xe0,0x9b,0x9b,0x61,0xa6,0xb6,0xfe,0x40,0xd2,0xdf,0x6a,0xf6,
203c2c66affSColin Finck 0x8d,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x05,
204c2c66affSColin Finck 0x00,0x30,0x81,0xb4,0x31,0x0b,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,
205c2c66affSColin Finck 0x55,0x53,0x31,0x17,0x30,0x15,0x06,0x03,0x55,0x04,0x0a,0x13,0x0e,0x56,0x65,
206c2c66affSColin Finck 0x72,0x69,0x53,0x69,0x67,0x6e,0x2c,0x20,0x49,0x6e,0x63,0x2e,0x31,0x1f,0x30,
207c2c66affSColin Finck 0x1d,0x06,0x03,0x55,0x04,0x0b,0x13,0x16,0x56,0x65,0x72,0x69,0x53,0x69,0x67,
208c2c66affSColin Finck 0x6e,0x20,0x54,0x72,0x75,0x73,0x74,0x20,0x4e,0x65,0x74,0x77,0x6f,0x72,0x6b,
209c2c66affSColin Finck 0x31,0x3b,0x30,0x39,0x06,0x03,0x55,0x04,0x0b,0x13,0x32,0x54,0x65,0x72,0x6d,
210c2c66affSColin Finck 0x73,0x20,0x6f,0x66,0x20,0x75,0x73,0x65,0x20,0x61,0x74,0x20,0x68,0x74,0x74,
211c2c66affSColin Finck 0x70,0x73,0x3a,0x2f,0x2f,0x77,0x77,0x77,0x2e,0x76,0x65,0x72,0x69,0x73,0x69,
212c2c66affSColin Finck 0x67,0x6e,0x2e,0x63,0x6f,0x6d,0x2f,0x72,0x70,0x61,0x20,0x28,0x63,0x29,0x30,
213c2c66affSColin Finck 0x34,0x31,0x2e,0x30,0x2c,0x06,0x03,0x55,0x04,0x03,0x13,0x25,0x56,0x65,0x72,
214c2c66affSColin Finck 0x69,0x53,0x69,0x67,0x6e,0x20,0x43,0x6c,0x61,0x73,0x73,0x20,0x33,0x20,0x43,
215c2c66affSColin Finck 0x6f,0x64,0x65,0x20,0x53,0x69,0x67,0x6e,0x69,0x6e,0x67,0x20,0x32,0x30,0x30,
216c2c66affSColin Finck 0x34,0x20,0x43,0x41,0x30,0x1e,0x17,0x0d,0x30,0x36,0x30,0x31,0x31,0x37,0x30,
217c2c66affSColin Finck 0x30,0x30,0x30,0x30,0x30,0x5a,0x17,0x0d,0x30,0x38,0x30,0x31,0x32,0x32,0x32,
218c2c66affSColin Finck 0x33,0x35,0x39,0x35,0x39,0x5a,0x30,0x81,0xb4,0x31,0x0b,0x30,0x09,0x06,0x03,
219c2c66affSColin Finck 0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x13,0x30,0x11,0x06,0x03,0x55,0x04,
220c2c66affSColin Finck 0x08,0x13,0x0a,0x43,0x61,0x6c,0x69,0x66,0x6f,0x72,0x6e,0x69,0x61,0x31,0x12,
221c2c66affSColin Finck 0x30,0x10,0x06,0x03,0x55,0x04,0x07,0x13,0x09,0x43,0x75,0x70,0x65,0x72,0x74,
222c2c66affSColin Finck 0x69,0x6e,0x6f,0x31,0x1d,0x30,0x1b,0x06,0x03,0x55,0x04,0x0a,0x14,0x14,0x41,
223c2c66affSColin Finck 0x70,0x70,0x6c,0x65,0x20,0x43,0x6f,0x6d,0x70,0x75,0x74,0x65,0x72,0x2c,0x20,
224c2c66affSColin Finck 0x49,0x6e,0x63,0x2e,0x31,0x3e,0x30,0x3c,0x06,0x03,0x55,0x04,0x0b,0x13,0x35,
225c2c66affSColin Finck 0x44,0x69,0x67,0x69,0x74,0x61,0x6c,0x20,0x49,0x44,0x20,0x43,0x6c,0x61,0x73,
226c2c66affSColin Finck 0x73,0x20,0x33,0x20,0x2d,0x20,0x4d,0x69,0x63,0x72,0x6f,0x73,0x6f,0x66,0x74,
227c2c66affSColin Finck 0x20,0x53,0x6f,0x66,0x74,0x77,0x61,0x72,0x65,0x20,0x56,0x61,0x6c,0x69,0x64,
228c2c66affSColin Finck 0x61,0x74,0x69,0x6f,0x6e,0x20,0x76,0x32,0x31,0x1d,0x30,0x1b,0x06,0x03,0x55,
229c2c66affSColin Finck 0x04,0x03,0x14,0x14,0x41,0x70,0x70,0x6c,0x65,0x20,0x43,0x6f,0x6d,0x70,0x75,
230c2c66affSColin Finck 0x74,0x65,0x72,0x2c,0x20,0x49,0x6e,0x63,0x2e,0x30,0x81,0x9f,0x30,0x0d,0x06,
231c2c66affSColin Finck 0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x01,0x05,0x00,0x03,0x81,0x8d,
232c2c66affSColin Finck 0x00,0x30,0x81,0x89,0x02,0x81,0x81,0x00,0xd3,0xab,0x3b,0x7f,0xec,0x48,0x84,
233c2c66affSColin Finck 0xce,0xa8,0x1a,0x12,0xf3,0x3c,0x87,0xcb,0x24,0x58,0x96,0x02,0x87,0x66,0x49,
234c2c66affSColin Finck 0xeb,0x89,0xee,0x79,0x44,0x70,0x8d,0xe7,0xd4,0x1f,0x30,0x92,0xc0,0x9c,0x35,
235c2c66affSColin Finck 0x78,0xc0,0xaf,0x1c,0xb6,0x28,0xd3,0xe0,0xe0,0x9d,0xd3,0x49,0x76,0x73,0x57,
236c2c66affSColin Finck 0x19,0x4d,0x8d,0x70,0x85,0x64,0x4d,0x1d,0xc6,0x02,0x3e,0xe5,0x2c,0x66,0x07,
237c2c66affSColin Finck 0xd2,0x27,0x4b,0xd6,0xc8,0x3c,0x93,0xb6,0x15,0x0c,0xde,0x5b,0xd7,0x93,0xdd,
238c2c66affSColin Finck 0xbe,0x85,0x62,0x34,0x17,0x8a,0x05,0x60,0xf0,0x8a,0x1c,0x5a,0x40,0x21,0x8d,
239c2c66affSColin Finck 0x51,0x6c,0xb0,0x62,0xd8,0xb5,0xd4,0xf9,0xb1,0xd0,0x58,0x7a,0x7a,0x82,0x55,
240c2c66affSColin Finck 0xb3,0xf9,0x53,0x71,0xde,0xd2,0xc9,0x37,0x8c,0xf6,0x5a,0x1f,0x2d,0xcd,0x7c,
241c2c66affSColin Finck 0x67,0x02,0x03,0x01,0x00,0x01,0xa3,0x82,0x01,0x7f,0x30,0x82,0x01,0x7b,0x30,
242c2c66affSColin Finck 0x09,0x06,0x03,0x55,0x1d,0x13,0x04,0x02,0x30,0x00,0x30,0x0e,0x06,0x03,0x55,
243c2c66affSColin Finck 0x1d,0x0f,0x01,0x01,0xff,0x04,0x04,0x03,0x02,0x07,0x80,0x30,0x40,0x06,0x03,
244c2c66affSColin Finck 0x55,0x1d,0x1f,0x04,0x39,0x30,0x37,0x30,0x35,0xa0,0x33,0xa0,0x31,0x86,0x2f,
245c2c66affSColin Finck 0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x43,0x53,0x43,0x33,0x2d,0x32,0x30,0x30,
246c2c66affSColin Finck 0x34,0x2d,0x63,0x72,0x6c,0x2e,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6e,0x2e,
247c2c66affSColin Finck 0x63,0x6f,0x6d,0x2f,0x43,0x53,0x43,0x33,0x2d,0x32,0x30,0x30,0x34,0x2e,0x63,
248c2c66affSColin Finck 0x72,0x6c,0x30,0x44,0x06,0x03,0x55,0x1d,0x20,0x04,0x3d,0x30,0x3b,0x30,0x39,
249c2c66affSColin Finck 0x06,0x0b,0x60,0x86,0x48,0x01,0x86,0xf8,0x45,0x01,0x07,0x17,0x03,0x30,0x2a,
250c2c66affSColin Finck 0x30,0x28,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x02,0x01,0x16,0x1c,0x68,
251c2c66affSColin Finck 0x74,0x74,0x70,0x73,0x3a,0x2f,0x2f,0x77,0x77,0x77,0x2e,0x76,0x65,0x72,0x69,
252c2c66affSColin Finck 0x73,0x69,0x67,0x6e,0x2e,0x63,0x6f,0x6d,0x2f,0x72,0x70,0x61,0x30,0x13,0x06,
253c2c66affSColin Finck 0x03,0x55,0x1d,0x25,0x04,0x0c,0x30,0x0a,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,
254c2c66affSColin Finck 0x07,0x03,0x03,0x30,0x75,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x01,0x01,
255c2c66affSColin Finck 0x04,0x69,0x30,0x67,0x30,0x24,0x06,0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x30,
256c2c66affSColin Finck 0x01,0x86,0x18,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x6f,0x63,0x73,0x70,0x2e,
257c2c66affSColin Finck 0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6e,0x2e,0x63,0x6f,0x6d,0x30,0x3f,0x06,
258c2c66affSColin Finck 0x08,0x2b,0x06,0x01,0x05,0x05,0x07,0x30,0x02,0x86,0x33,0x68,0x74,0x74,0x70,
259c2c66affSColin Finck 0x3a,0x2f,0x2f,0x43,0x53,0x43,0x33,0x2d,0x32,0x30,0x30,0x34,0x2d,0x61,0x69,
260c2c66affSColin Finck 0x61,0x2e,0x76,0x65,0x72,0x69,0x73,0x69,0x67,0x6e,0x2e,0x63,0x6f,0x6d,0x2f,
261c2c66affSColin Finck 0x43,0x53,0x43,0x33,0x2d,0x32,0x30,0x30,0x34,0x2d,0x61,0x69,0x61,0x2e,0x63,
262c2c66affSColin Finck 0x65,0x72,0x30,0x1f,0x06,0x03,0x55,0x1d,0x23,0x04,0x18,0x30,0x16,0x80,0x14,
263c2c66affSColin Finck 0x08,0xf5,0x51,0xe8,0xfb,0xfe,0x3d,0x3d,0x64,0x36,0x7c,0x68,0xcf,0x5b,0x78,
264c2c66affSColin Finck 0xa8,0xdf,0xb9,0xc5,0x37,0x30,0x11,0x06,0x09,0x60,0x86,0x48,0x01,0x86,0xf8,
265c2c66affSColin Finck 0x42,0x01,0x01,0x04,0x04,0x03,0x02,0x04,0x10,0x30,0x16,0x06,0x0a,0x2b,0x06,
266c2c66affSColin Finck 0x01,0x04,0x01,0x82,0x37,0x02,0x01,0x1b,0x04,0x08,0x30,0x06,0x01,0x01,0x00,
267c2c66affSColin Finck 0x01,0x01,0xff,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,
268c2c66affSColin Finck 0x05,0x05,0x00,0x03,0x82,0x01,0x01,0x00,0x6a,0xa6,0x06,0xd0,0x33,0x18,0x64,
269c2c66affSColin Finck 0xe2,0x69,0x82,0xee,0x6e,0x36,0x9e,0x9d,0x9a,0x0e,0x18,0xa8,0xac,0x9d,0x10,
270c2c66affSColin Finck 0xed,0x01,0x3c,0xb9,0x61,0x04,0x62,0xf3,0x85,0x8f,0xcc,0x4f,0x2c,0x66,0x35,
271c2c66affSColin Finck 0x54,0x25,0x45,0x8d,0x95,0x1c,0xd2,0x33,0xbe,0x2e,0xdd,0x7f,0x74,0xaf,0x03,
272c2c66affSColin Finck 0x7b,0x86,0x63,0xb0,0xc9,0xe6,0xbd,0xc7,0x8e,0xde,0x03,0x18,0x98,0x82,0xc3,
273c2c66affSColin Finck 0xbb,0xf8,0x15,0x99,0x1a,0xa9,0xdd,0xb9,0x5d,0xb9,0xbd,0x53,0x95,0x25,0x76,
274c2c66affSColin Finck 0xfb,0x5c,0x53,0x90,0xea,0x01,0x0a,0xa0,0xb1,0xbf,0x09,0x1b,0x97,0x8f,0x40,
275c2c66affSColin Finck 0xfa,0x85,0x12,0x74,0x01,0xdb,0xf6,0xdb,0x09,0xd6,0x5f,0x4f,0xd7,0x17,0xb4,
276c2c66affSColin Finck 0xbf,0x9e,0x2f,0x86,0x52,0x5d,0x70,0x24,0x52,0x32,0x1e,0xa5,0x1d,0x39,0x8b,
277c2c66affSColin Finck 0x66,0xf6,0xba,0x9b,0x69,0x8e,0x12,0x60,0xdb,0xb6,0xcf,0xe6,0x0d,0xd6,0x1c,
278c2c66affSColin Finck 0x8f,0xd4,0x5b,0x4b,0x00,0xde,0x21,0x93,0xfb,0x6e,0xc7,0x3d,0xb4,0x66,0x0d,
279c2c66affSColin Finck 0x29,0x0c,0x4e,0xe9,0x3f,0x94,0xd6,0xd6,0xdc,0xec,0xf8,0x53,0x3b,0x62,0xd5,
280c2c66affSColin Finck 0x97,0x50,0x53,0x84,0x17,0xfe,0xe2,0xed,0x4c,0x23,0x0a,0x49,0xce,0x5b,0xe9,
281c2c66affSColin Finck 0x70,0x31,0xc1,0x04,0x02,0x02,0x6c,0xb8,0x52,0xcd,0xc7,0x4e,0x70,0xb4,0x13,
282c2c66affSColin Finck 0xd7,0xe0,0x92,0xba,0x44,0x1a,0x10,0x4c,0x6e,0x45,0xc6,0x86,0x04,0xc6,0x64,
283c2c66affSColin Finck 0xd3,0x9c,0x6e,0xc1,0x9c,0xac,0x74,0x3d,0x77,0x06,0x5e,0x28,0x28,0x5c,0xf5,
284c2c66affSColin Finck 0xe0,0x9c,0x19,0xd8,0xba,0x74,0x81,0x2d,0x67,0x77,0x93,0x8d,0xbf,0xd2,0x52,
285c2c66affSColin Finck 0x00,0xe6,0xa5,0x38,0x4e,0x2e,0x73,0x66,0x7a };
286c2c66affSColin Finck static const BYTE signedCRL[] = { 0x30, 0x45, 0x30, 0x2c, 0x30, 0x02, 0x06,
287c2c66affSColin Finck  0x00, 0x30, 0x15, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,
288c2c66affSColin Finck  0x0a, 0x4a, 0x75, 0x61, 0x6e, 0x20, 0x4c, 0x61, 0x6e, 0x67, 0x00, 0x18, 0x0f,
289c2c66affSColin Finck  0x31, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30,
290c2c66affSColin Finck  0x30, 0x5a, 0x30, 0x02, 0x06, 0x00, 0x03, 0x11, 0x00, 0x0f, 0x0e, 0x0d, 0x0c,
291c2c66affSColin Finck  0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 };
292c2c66affSColin Finck 
293c2c66affSColin Finck /* CBT hook to ensure a window (e.g., MessageBox) cannot be created */
294c2c66affSColin Finck static HHOOK hook;
cbt_hook_proc(int code,WPARAM wp,LPARAM lp)295c2c66affSColin Finck static LRESULT CALLBACK cbt_hook_proc(int code, WPARAM wp, LPARAM lp)
296c2c66affSColin Finck {
297c2c66affSColin Finck     return code == HCBT_CREATEWND ? 1: CallNextHookEx(hook, code, wp, lp);
298c2c66affSColin Finck }
299c2c66affSColin Finck 
300c2c66affSColin Finck static BOOL (WINAPI *pCryptUIWizImport)(DWORD dwFlags, HWND hwndParent,
301c2c66affSColin Finck  LPCWSTR pwszWizardTitle, PCCRYPTUI_WIZ_IMPORT_SRC_INFO pImportSrc,
302c2c66affSColin Finck  HCERTSTORE hDestCertStore);
303c2c66affSColin Finck 
find_and_delete_cert_in_store(HCERTSTORE store,PCCERT_CONTEXT cert)304c2c66affSColin Finck static BOOL find_and_delete_cert_in_store(HCERTSTORE store, PCCERT_CONTEXT cert)
305c2c66affSColin Finck {
306c2c66affSColin Finck     CERT_ID id;
307c2c66affSColin Finck     PCCERT_CONTEXT found;
308c2c66affSColin Finck 
309c2c66affSColin Finck     id.dwIdChoice = CERT_ID_ISSUER_SERIAL_NUMBER;
310c2c66affSColin Finck     memcpy(&id.u.IssuerSerialNumber.Issuer,
311c2c66affSColin Finck      &cert->pCertInfo->Issuer, sizeof(CERT_NAME_BLOB));
312c2c66affSColin Finck     memcpy(&id.u.IssuerSerialNumber.SerialNumber,
313c2c66affSColin Finck      &cert->pCertInfo->SerialNumber, sizeof(CRYPT_INTEGER_BLOB));
314c2c66affSColin Finck     found = CertFindCertificateInStore(store, X509_ASN_ENCODING, 0,
315c2c66affSColin Finck      CERT_FIND_CERT_ID, &id, NULL);
316c2c66affSColin Finck     if (!found)
317c2c66affSColin Finck         return FALSE;
318c2c66affSColin Finck 
319c2c66affSColin Finck     CertDeleteCertificateFromStore(found);
320c2c66affSColin Finck 
321c2c66affSColin Finck     return TRUE;
322c2c66affSColin Finck }
323c2c66affSColin Finck 
test_crypt_ui_wiz_import(void)324c2c66affSColin Finck static void test_crypt_ui_wiz_import(void)
325c2c66affSColin Finck {
326c2c66affSColin Finck     BOOL ret;
327c2c66affSColin Finck     CRYPTUI_WIZ_IMPORT_SRC_INFO info;
328c2c66affSColin Finck     HCERTSTORE store;
329c2c66affSColin Finck     PCCERT_CONTEXT cert;
330c2c66affSColin Finck     PCCRL_CONTEXT crl;
331c2c66affSColin Finck     DWORD count;
332c2c66affSColin Finck 
333c2c66affSColin Finck     if (!pCryptUIWizImport)
334c2c66affSColin Finck     {
335c2c66affSColin Finck         skip("No CryptUIWizImport\n");
336c2c66affSColin Finck         return;
337c2c66affSColin Finck     }
338c2c66affSColin Finck 
339c2c66affSColin Finck     /* Set CBT hook to disallow MessageBox and wizard creation in current
340c2c66affSColin Finck      * thread.
341c2c66affSColin Finck      */
342c2c66affSColin Finck     hook = SetWindowsHookExA(WH_CBT, cbt_hook_proc, 0, GetCurrentThreadId());
343c2c66affSColin Finck 
344c2c66affSColin Finck     /* Brings up UI.  Cancelling yields ret = 1. */
345c2c66affSColin Finck     if (0)
346c2c66affSColin Finck     {
347c2c66affSColin Finck         pCryptUIWizImport(0, 0, NULL, NULL, NULL);
348c2c66affSColin Finck     }
349c2c66affSColin Finck     SetLastError(0xdeadbeef);
350c2c66affSColin Finck     ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI, 0, NULL, NULL, NULL);
351c2c66affSColin Finck     ok(!ret && GetLastError() == E_INVALIDARG,
352c2c66affSColin Finck      "expected E_INVALIDARG, got %08x\n", GetLastError());
353c2c66affSColin Finck     memset(&info, 0, sizeof(info));
354c2c66affSColin Finck     SetLastError(0xdeadbeef);
355c2c66affSColin Finck     ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI, 0, NULL, &info, NULL);
356c2c66affSColin Finck     ok(!ret && GetLastError() == E_INVALIDARG,
357c2c66affSColin Finck      "expected E_INVALIDARG, got %08x\n", GetLastError());
358c2c66affSColin Finck     info.dwSize = sizeof(info);
359c2c66affSColin Finck     SetLastError(0xdeadbeef);
360c2c66affSColin Finck     ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI, 0, NULL, &info, NULL);
361c2c66affSColin Finck     ok(!ret && GetLastError() == E_INVALIDARG,
362c2c66affSColin Finck      "expected E_INVALIDARG, got %08x\n", GetLastError());
363c2c66affSColin Finck     info.dwSubjectChoice = CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_CONTEXT;
364c2c66affSColin Finck     SetLastError(0xdeadbeef);
365c2c66affSColin Finck     ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI, 0, NULL, &info, NULL);
366c2c66affSColin Finck     ok(!ret && GetLastError() == E_INVALIDARG,
367c2c66affSColin Finck      "expected E_INVALIDARG, got %08x\n", GetLastError());
368c2c66affSColin Finck     SetLastError(0xdeadbeef);
369c2c66affSColin Finck     ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI | CRYPTUI_WIZ_IMPORT_ALLOW_CERT,
370c2c66affSColin Finck      0, NULL, &info, NULL);
371c2c66affSColin Finck     ok(!ret && GetLastError() == E_INVALIDARG,
372c2c66affSColin Finck      "expected E_INVALIDARG, got %08x\n", GetLastError());
373c2c66affSColin Finck     /* Check allowed vs. given type mismatches */
374c2c66affSColin Finck     info.u.pCertContext = CertCreateCertificateContext(X509_ASN_ENCODING,
375c2c66affSColin Finck      v1CertWithValidPubKey, sizeof(v1CertWithValidPubKey));
376c2c66affSColin Finck     SetLastError(0xdeadbeef);
377c2c66affSColin Finck     ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI | CRYPTUI_WIZ_IMPORT_ALLOW_CRL,
378c2c66affSColin Finck      0, NULL, &info, NULL);
379c2c66affSColin Finck     ok(!ret && GetLastError() == E_INVALIDARG,
380c2c66affSColin Finck      "expected E_INVALIDARG, got %08x\n", GetLastError());
381c2c66affSColin Finck     CertFreeCertificateContext(info.u.pCertContext);
382c2c66affSColin Finck     info.dwSubjectChoice = CRYPTUI_WIZ_IMPORT_SUBJECT_CRL_CONTEXT;
383c2c66affSColin Finck     info.u.pCRLContext = CertCreateCRLContext(X509_ASN_ENCODING,
384c2c66affSColin Finck      signedCRL, sizeof(signedCRL));
385c2c66affSColin Finck     SetLastError(0xdeadbeef);
386c2c66affSColin Finck     ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI | CRYPTUI_WIZ_IMPORT_ALLOW_CERT,
387c2c66affSColin Finck      0, NULL, &info, NULL);
388c2c66affSColin Finck     ok(!ret && GetLastError() == E_INVALIDARG,
389c2c66affSColin Finck      "expected E_INVALIDARG, got %08x\n", GetLastError());
390c2c66affSColin Finck     CertFreeCRLContext(info.u.pCRLContext);
391c2c66affSColin Finck     /* Imports the following cert--self-signed, with no basic constraints set--
392c2c66affSColin Finck      * to the CA store.  Puts up a dialog at the end if it succeeds or fails.
393c2c66affSColin Finck      */
394c2c66affSColin Finck     info.dwSubjectChoice = CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_CONTEXT;
395c2c66affSColin Finck     info.u.pCertContext = CertCreateCertificateContext(X509_ASN_ENCODING,
396c2c66affSColin Finck      v1CertWithValidPubKey, sizeof(v1CertWithValidPubKey));
397c2c66affSColin Finck     ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI, 0, NULL, &info, NULL);
398c2c66affSColin Finck     ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
399c2c66affSColin Finck     if (ret)
400c2c66affSColin Finck     {
401c2c66affSColin Finck         static const WCHAR CA[] = { 'C','A',0 };
402c2c66affSColin Finck         HCERTSTORE ca = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0,
403c2c66affSColin Finck          CERT_SYSTEM_STORE_CURRENT_USER, CA);
404c2c66affSColin Finck 
405c2c66affSColin Finck         if (ca)
406c2c66affSColin Finck         {
407c2c66affSColin Finck             ret = find_and_delete_cert_in_store(ca, info.u.pCertContext);
408c2c66affSColin Finck             ok(ret ||
409c2c66affSColin Finck              broken(!ret) /* Win9x/NT4 */,
410c2c66affSColin Finck              "expected to find v1CertWithValidPubKey in CA store\n");
411c2c66affSColin Finck             CertCloseStore(ca, 0);
412c2c66affSColin Finck         }
413c2c66affSColin Finck     }
414c2c66affSColin Finck     CertFreeCertificateContext(info.u.pCertContext);
415c2c66affSColin Finck     /* Imports the following cert--not self-signed, with a basic constraints2
416c2c66affSColin Finck      * extensions--to the "AddressBook" store.  Puts up a dialog at the end if
417c2c66affSColin Finck      * it succeeds or fails.
418c2c66affSColin Finck      */
419c2c66affSColin Finck     info.u.pCertContext = CertCreateCertificateContext(X509_ASN_ENCODING,
420c2c66affSColin Finck      iTunesCert3, sizeof(iTunesCert3));
421c2c66affSColin Finck     ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI, 0, NULL, &info, NULL);
422c2c66affSColin Finck     ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
423c2c66affSColin Finck     if (ret)
424c2c66affSColin Finck     {
425c2c66affSColin Finck         static const WCHAR AddressBook[] = { 'A','d','d','r','e','s','s',
426c2c66affSColin Finck          'B','o','o','k',0 };
427c2c66affSColin Finck         HCERTSTORE addressBook = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0,
428c2c66affSColin Finck          CERT_SYSTEM_STORE_CURRENT_USER, AddressBook);
429c2c66affSColin Finck 
430c2c66affSColin Finck         if (addressBook)
431c2c66affSColin Finck         {
432c2c66affSColin Finck             ret = find_and_delete_cert_in_store(addressBook,
433c2c66affSColin Finck              info.u.pCertContext);
434c2c66affSColin Finck             ok(ret ||
435c2c66affSColin Finck              broken(!ret),  /* Windows 2000 and earlier */
436c2c66affSColin Finck              "expected to find iTunesCert3 in AddressBook store\n");
437c2c66affSColin Finck             CertCloseStore(addressBook, 0);
438c2c66affSColin Finck         }
439c2c66affSColin Finck     }
440c2c66affSColin Finck     /* Displays the wizard, but disables the "Certificate store" edit and
441c2c66affSColin Finck      * the Browse button.  Confusingly, the "Place all certificates in the
442c2c66affSColin Finck      * following store" radio button is not disabled.
443c2c66affSColin Finck      */
444c2c66affSColin Finck     if (0)
445c2c66affSColin Finck     {
446c2c66affSColin Finck         ret = pCryptUIWizImport(CRYPTUI_WIZ_IMPORT_NO_CHANGE_DEST_STORE, 0,
447c2c66affSColin Finck          NULL, &info, NULL);
448c2c66affSColin Finck         ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
449c2c66affSColin Finck     }
450c2c66affSColin Finck     store = CertOpenStore(CERT_STORE_PROV_MEMORY, X509_ASN_ENCODING, 0,
451c2c66affSColin Finck      CERT_STORE_CREATE_NEW_FLAG, NULL);
452c2c66affSColin Finck     /* Displays the wizard, but sets the "Certificate store" edit to the
453c2c66affSColin Finck      * string "Determined by the program", and disables it and the Browse
454c2c66affSColin Finck      * button, as well as the "Automatically select the certificate store
455c2c66affSColin Finck      * based on the type of certificate" radio button.
456c2c66affSColin Finck      */
457c2c66affSColin Finck     if (0)
458c2c66affSColin Finck     {
459c2c66affSColin Finck         ret = pCryptUIWizImport(CRYPTUI_WIZ_IMPORT_NO_CHANGE_DEST_STORE, 0,
460c2c66affSColin Finck          NULL, &info, store);
461c2c66affSColin Finck         ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
462c2c66affSColin Finck     }
463c2c66affSColin Finck     ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI |
464c2c66affSColin Finck      CRYPTUI_WIZ_IMPORT_NO_CHANGE_DEST_STORE, 0, NULL, &info, store);
465c2c66affSColin Finck     ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
466c2c66affSColin Finck     ret = find_and_delete_cert_in_store(store, info.u.pCertContext);
467c2c66affSColin Finck     ok(ret ||
468c2c66affSColin Finck      broken(!ret) /* Win9x/NT4 */,
469c2c66affSColin Finck      "expected to find iTunesCert3 in memory store\n");
470c2c66affSColin Finck     CertFreeCertificateContext(info.u.pCertContext);
471c2c66affSColin Finck     CertCloseStore(store, 0);
472c2c66affSColin Finck 
473c2c66affSColin Finck     info.u.pCertContext = CertCreateCertificateContext(X509_ASN_ENCODING,
474c2c66affSColin Finck      iTunesCert1, sizeof(iTunesCert1));
475c2c66affSColin Finck     ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI, 0, NULL, &info, NULL);
476c2c66affSColin Finck     ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
477c2c66affSColin Finck     if (ret)
478c2c66affSColin Finck     {
479c2c66affSColin Finck         static const WCHAR AddressBook[] = { 'A','d','d','r','e','s','s',
480c2c66affSColin Finck          'B','o','o','k',0 };
481c2c66affSColin Finck         HCERTSTORE addressBook = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0,
482c2c66affSColin Finck          CERT_SYSTEM_STORE_CURRENT_USER, AddressBook);
483c2c66affSColin Finck 
484c2c66affSColin Finck         if (addressBook)
485c2c66affSColin Finck         {
486c2c66affSColin Finck             ret = find_and_delete_cert_in_store(addressBook,
487c2c66affSColin Finck              info.u.pCertContext);
488c2c66affSColin Finck             ok(ret ||
489c2c66affSColin Finck              broken(!ret),  /* Windows 2000 and earlier */
490c2c66affSColin Finck              "expected to find iTunesCert1 in AddressBook store\n");
491c2c66affSColin Finck             CertCloseStore(addressBook, 0);
492c2c66affSColin Finck         }
493c2c66affSColin Finck     }
494c2c66affSColin Finck     CertFreeCertificateContext(info.u.pCertContext);
495c2c66affSColin Finck 
496c2c66affSColin Finck     info.u.pCertContext = CertCreateCertificateContext(X509_ASN_ENCODING,
497c2c66affSColin Finck      iTunesCert2, sizeof(iTunesCert2));
498c2c66affSColin Finck     ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI, 0, NULL, &info, NULL);
499c2c66affSColin Finck     ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
500c2c66affSColin Finck     if (ret)
501c2c66affSColin Finck     {
502c2c66affSColin Finck         static const WCHAR CA[] = { 'C','A',0 };
503c2c66affSColin Finck         HCERTSTORE ca = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0,
504c2c66affSColin Finck          CERT_SYSTEM_STORE_CURRENT_USER, CA);
505c2c66affSColin Finck 
506c2c66affSColin Finck         if (ca)
507c2c66affSColin Finck         {
508c2c66affSColin Finck             ret = find_and_delete_cert_in_store(ca, info.u.pCertContext);
509c2c66affSColin Finck             ok(ret ||
510c2c66affSColin Finck              broken(!ret) /* Win9x/NT4 */,
511c2c66affSColin Finck              "expected to find iTunesCert2 in CA store\n");
512c2c66affSColin Finck             CertCloseStore(ca, 0);
513c2c66affSColin Finck         }
514c2c66affSColin Finck     }
515c2c66affSColin Finck     CertFreeCertificateContext(info.u.pCertContext);
516c2c66affSColin Finck 
517c2c66affSColin Finck     info.u.hCertStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
518c2c66affSColin Finck      CERT_STORE_CREATE_NEW_FLAG, NULL);
519c2c66affSColin Finck     CertAddEncodedCertificateToStore(info.u.hCertStore, X509_ASN_ENCODING,
520c2c66affSColin Finck      v1CertWithValidPubKey, sizeof(v1CertWithValidPubKey),
521c2c66affSColin Finck      CERT_STORE_ADD_ALWAYS, NULL);
522c2c66affSColin Finck     CertAddEncodedCRLToStore(info.u.hCertStore, X509_ASN_ENCODING, signedCRL,
523c2c66affSColin Finck      sizeof(signedCRL), CERT_STORE_ADD_ALWAYS, NULL);
524c2c66affSColin Finck     info.dwSubjectChoice = CRYPTUI_WIZ_IMPORT_SUBJECT_CERT_STORE;
525c2c66affSColin Finck     /* The ALLOW flags aren't allowed with a store as the source if the source
526c2c66affSColin Finck      * contains types other than those allowed.
527c2c66affSColin Finck      */
528c2c66affSColin Finck     store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
529c2c66affSColin Finck      CERT_STORE_CREATE_NEW_FLAG, NULL);
530c2c66affSColin Finck     SetLastError(0xdeadbeef);
531c2c66affSColin Finck     ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI | CRYPTUI_WIZ_IMPORT_ALLOW_CERT,
532c2c66affSColin Finck      0, NULL, &info, store);
533c2c66affSColin Finck     ok(!ret && GetLastError() == E_INVALIDARG,
534c2c66affSColin Finck      "expected E_INVALIDARG, got %08x\n", GetLastError());
535c2c66affSColin Finck     SetLastError(0xdeadbeef);
536c2c66affSColin Finck     ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI | CRYPTUI_WIZ_IMPORT_ALLOW_CRL,
537c2c66affSColin Finck      0, NULL, &info, store);
538c2c66affSColin Finck     ok(!ret && GetLastError() == E_INVALIDARG,
539c2c66affSColin Finck      "expected E_INVALIDARG, got %08x\n", GetLastError());
540c2c66affSColin Finck     SetLastError(0xdeadbeef);
541c2c66affSColin Finck     ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI |
542c2c66affSColin Finck      CRYPTUI_WIZ_IMPORT_NO_CHANGE_DEST_STORE |
543c2c66affSColin Finck      CRYPTUI_WIZ_IMPORT_ALLOW_CERT | CRYPTUI_WIZ_IMPORT_ALLOW_CRL, 0, NULL,
544c2c66affSColin Finck      &info, store);
545c2c66affSColin Finck     ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
546c2c66affSColin Finck     if (ret)
547c2c66affSColin Finck     {
548c2c66affSColin Finck         count = 0;
549c2c66affSColin Finck         cert = NULL;
550c2c66affSColin Finck         do {
551c2c66affSColin Finck             cert = CertEnumCertificatesInStore(store, cert);
552c2c66affSColin Finck             if (cert)
553c2c66affSColin Finck                 count++;
554c2c66affSColin Finck         } while (cert);
555c2c66affSColin Finck         ok(count == 1, "expected 1 cert, got %d\n", count);
556c2c66affSColin Finck         count = 0;
557c2c66affSColin Finck         crl = NULL;
558c2c66affSColin Finck         do {
559c2c66affSColin Finck             crl = CertEnumCRLsInStore(store, crl);
560c2c66affSColin Finck             if (crl)
561c2c66affSColin Finck                 count++;
562c2c66affSColin Finck         } while (crl);
563c2c66affSColin Finck         ok(count == 1, "expected 1 CRL, got %d\n", count);
564c2c66affSColin Finck     }
565c2c66affSColin Finck     CertCloseStore(store, 0);
566c2c66affSColin Finck     CertCloseStore(info.u.hCertStore, 0);
567c2c66affSColin Finck 
568c2c66affSColin Finck     /* If the ALLOW flags match the content of the store, the store can be
569c2c66affSColin Finck      * imported.
570c2c66affSColin Finck      */
571c2c66affSColin Finck     info.u.hCertStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
572c2c66affSColin Finck      CERT_STORE_CREATE_NEW_FLAG, NULL);
573c2c66affSColin Finck     CertAddEncodedCertificateToStore(info.u.hCertStore, X509_ASN_ENCODING,
574c2c66affSColin Finck      v1CertWithValidPubKey, sizeof(v1CertWithValidPubKey),
575c2c66affSColin Finck      CERT_STORE_ADD_ALWAYS, NULL);
576c2c66affSColin Finck     store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
577c2c66affSColin Finck      CERT_STORE_CREATE_NEW_FLAG, NULL);
578c2c66affSColin Finck     SetLastError(0xdeadbeef);
579c2c66affSColin Finck     ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI | CRYPTUI_WIZ_IMPORT_ALLOW_CERT,
580c2c66affSColin Finck      0, NULL, &info, store);
581c2c66affSColin Finck     ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
582c2c66affSColin Finck     if (ret)
583c2c66affSColin Finck     {
584c2c66affSColin Finck         count = 0;
585c2c66affSColin Finck         cert = NULL;
586c2c66affSColin Finck         do {
587c2c66affSColin Finck             cert = CertEnumCertificatesInStore(store, cert);
588c2c66affSColin Finck             if (cert)
589c2c66affSColin Finck                 count++;
590c2c66affSColin Finck         } while (cert);
591c2c66affSColin Finck         ok(count == 1, "expected 1 cert, got %d\n", count);
592c2c66affSColin Finck         count = 0;
593c2c66affSColin Finck         crl = NULL;
594c2c66affSColin Finck         do {
595c2c66affSColin Finck             crl = CertEnumCRLsInStore(store, crl);
596c2c66affSColin Finck             if (crl)
597c2c66affSColin Finck                 count++;
598c2c66affSColin Finck         } while (crl);
599c2c66affSColin Finck         ok(count == 0, "expected 0 CRLs, got %d\n", count);
600c2c66affSColin Finck     }
601c2c66affSColin Finck     SetLastError(0xdeadbeef);
602c2c66affSColin Finck     ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI | CRYPTUI_WIZ_IMPORT_ALLOW_CRL,
603c2c66affSColin Finck      0, NULL, &info, store);
604c2c66affSColin Finck     ok(!ret && GetLastError() == E_INVALIDARG,
605c2c66affSColin Finck      "expected E_INVALIDARG, got %08x\n", GetLastError());
606c2c66affSColin Finck     CertCloseStore(store, 0);
607c2c66affSColin Finck     CertCloseStore(info.u.hCertStore, 0);
608c2c66affSColin Finck 
609c2c66affSColin Finck     /* Again, if the ALLOW flags match the content of the store, the store can
610c2c66affSColin Finck      * be imported.
611c2c66affSColin Finck      */
612c2c66affSColin Finck     info.u.hCertStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
613c2c66affSColin Finck      CERT_STORE_CREATE_NEW_FLAG, NULL);
614c2c66affSColin Finck     CertAddEncodedCRLToStore(info.u.hCertStore, X509_ASN_ENCODING, signedCRL,
615c2c66affSColin Finck      sizeof(signedCRL), CERT_STORE_ADD_ALWAYS, NULL);
616c2c66affSColin Finck     store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
617c2c66affSColin Finck      CERT_STORE_CREATE_NEW_FLAG, NULL);
618c2c66affSColin Finck     SetLastError(0xdeadbeef);
619c2c66affSColin Finck     ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI | CRYPTUI_WIZ_IMPORT_ALLOW_CRL,
620c2c66affSColin Finck      0, NULL, &info, store);
621c2c66affSColin Finck     ok(ret, "CryptUIWizImport failed: %08x\n", GetLastError());
622c2c66affSColin Finck     if (ret)
623c2c66affSColin Finck     {
624c2c66affSColin Finck         count = 0;
625c2c66affSColin Finck         cert = NULL;
626c2c66affSColin Finck         do {
627c2c66affSColin Finck             cert = CertEnumCertificatesInStore(store, cert);
628c2c66affSColin Finck             if (cert)
629c2c66affSColin Finck                 count++;
630c2c66affSColin Finck         } while (cert);
631c2c66affSColin Finck         ok(count == 0, "expected 0 certs, got %d\n", count);
632c2c66affSColin Finck         count = 0;
633c2c66affSColin Finck         crl = NULL;
634c2c66affSColin Finck         do {
635c2c66affSColin Finck             crl = CertEnumCRLsInStore(store, crl);
636c2c66affSColin Finck             if (crl)
637c2c66affSColin Finck                 count++;
638c2c66affSColin Finck         } while (crl);
639c2c66affSColin Finck         ok(count == 1, "expected 1 CRL, got %d\n", count);
640c2c66affSColin Finck     }
641c2c66affSColin Finck     SetLastError(0xdeadbeef);
642c2c66affSColin Finck     ret = pCryptUIWizImport(CRYPTUI_WIZ_NO_UI | CRYPTUI_WIZ_IMPORT_ALLOW_CERT,
643c2c66affSColin Finck      0, NULL, &info, store);
644c2c66affSColin Finck     ok(!ret && GetLastError() == E_INVALIDARG,
645c2c66affSColin Finck      "expected E_INVALIDARG, got %08x\n", GetLastError());
646c2c66affSColin Finck     CertCloseStore(store, 0);
647c2c66affSColin Finck     CertCloseStore(info.u.hCertStore, 0);
648c2c66affSColin Finck 
649c2c66affSColin Finck     UnhookWindowsHookEx(hook);
650c2c66affSColin Finck }
651c2c66affSColin Finck 
START_TEST(cryptui)652c2c66affSColin Finck START_TEST(cryptui)
653c2c66affSColin Finck {
654c2c66affSColin Finck     HMODULE lib = LoadLibraryA("cryptui");
655c2c66affSColin Finck 
656c2c66affSColin Finck     if (lib)
657c2c66affSColin Finck     {
658c2c66affSColin Finck         pCryptUIWizImport = (void *)GetProcAddress(lib, "CryptUIWizImport");
659c2c66affSColin Finck 
660c2c66affSColin Finck         test_crypt_ui_wiz_import();
661c2c66affSColin Finck         FreeLibrary(lib);
662c2c66affSColin Finck     }
663c2c66affSColin Finck }
664