]> git.saurik.com Git - apple/security.git/blob - sec/Security/Regressions/secitem/si-27-sectrust-exceptions.c
Security-55471.14.18.tar.gz
[apple/security.git] / sec / Security / Regressions / secitem / si-27-sectrust-exceptions.c
1 /*
2 * Copyright (c) 2006-2010 Apple Inc. All Rights Reserved.
3 */
4
5 #include <CoreFoundation/CoreFoundation.h>
6 #include <Security/SecCertificate.h>
7 #include <Security/SecCertificatePriv.h>
8 #include <Security/SecPolicy.h>
9 #include <Security/SecTrustPriv.h>
10 #include <utilities/array_size.h>
11 #include <stdlib.h>
12 #include <unistd.h>
13
14 #include "Security_regressions.h"
15
16 /*
17 subject= /C=US/ST=California/L=Cupertino/O=Apple Computer, Inc./OU=Apple Internet Services/OU=Terms of use at www.verisign.com/rpa (c)00/CN=store.apple.com
18 issuer= /O=VeriSign Trust Network/OU=VeriSign, Inc./OU=VeriSign International Server CA - Class 3/OU=www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign
19 serial=4450E623F57E734FF85C1DEEFB976C86
20 */
21 static const uint8_t _c0[] = {
22 0x30, 0x82, 0x04, 0x82, 0x30, 0x82, 0x03, 0xeb,
23 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x44,
24 0x50, 0xe6, 0x23, 0xf5, 0x7e, 0x73, 0x4f, 0xf8,
25 0x5c, 0x1d, 0xee, 0xfb, 0x97, 0x6c, 0x86, 0x30,
26 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
27 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x81,
28 0xba, 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x03, 0x55,
29 0x04, 0x0a, 0x13, 0x16, 0x56, 0x65, 0x72, 0x69,
30 0x53, 0x69, 0x67, 0x6e, 0x20, 0x54, 0x72, 0x75,
31 0x73, 0x74, 0x20, 0x4e, 0x65, 0x74, 0x77, 0x6f,
32 0x72, 0x6b, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03,
33 0x55, 0x04, 0x0b, 0x13, 0x0e, 0x56, 0x65, 0x72,
34 0x69, 0x53, 0x69, 0x67, 0x6e, 0x2c, 0x20, 0x49,
35 0x6e, 0x63, 0x2e, 0x31, 0x33, 0x30, 0x31, 0x06,
36 0x03, 0x55, 0x04, 0x0b, 0x13, 0x2a, 0x56, 0x65,
37 0x72, 0x69, 0x53, 0x69, 0x67, 0x6e, 0x20, 0x49,
38 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x69,
39 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x53, 0x65, 0x72,
40 0x76, 0x65, 0x72, 0x20, 0x43, 0x41, 0x20, 0x2d,
41 0x20, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x20, 0x33,
42 0x31, 0x49, 0x30, 0x47, 0x06, 0x03, 0x55, 0x04,
43 0x0b, 0x13, 0x40, 0x77, 0x77, 0x77, 0x2e, 0x76,
44 0x65, 0x72, 0x69, 0x73, 0x69, 0x67, 0x6e, 0x2e,
45 0x63, 0x6f, 0x6d, 0x2f, 0x43, 0x50, 0x53, 0x20,
46 0x49, 0x6e, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x62,
47 0x79, 0x20, 0x52, 0x65, 0x66, 0x2e, 0x20, 0x4c,
48 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59,
49 0x20, 0x4c, 0x54, 0x44, 0x2e, 0x28, 0x63, 0x29,
50 0x39, 0x37, 0x20, 0x56, 0x65, 0x72, 0x69, 0x53,
51 0x69, 0x67, 0x6e, 0x30, 0x1e, 0x17, 0x0d, 0x30,
52 0x35, 0x30, 0x33, 0x30, 0x32, 0x30, 0x30, 0x30,
53 0x30, 0x30, 0x30, 0x5a, 0x17, 0x0d, 0x30, 0x37,
54 0x30, 0x34, 0x30, 0x31, 0x32, 0x33, 0x35, 0x39,
55 0x35, 0x39, 0x5a, 0x30, 0x81, 0xc6, 0x31, 0x0b,
56 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
57 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06,
58 0x03, 0x55, 0x04, 0x08, 0x13, 0x0a, 0x43, 0x61,
59 0x6c, 0x69, 0x66, 0x6f, 0x72, 0x6e, 0x69, 0x61,
60 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04,
61 0x07, 0x14, 0x09, 0x43, 0x75, 0x70, 0x65, 0x72,
62 0x74, 0x69, 0x6e, 0x6f, 0x31, 0x1d, 0x30, 0x1b,
63 0x06, 0x03, 0x55, 0x04, 0x0a, 0x14, 0x14, 0x41,
64 0x70, 0x70, 0x6c, 0x65, 0x20, 0x43, 0x6f, 0x6d,
65 0x70, 0x75, 0x74, 0x65, 0x72, 0x2c, 0x20, 0x49,
66 0x6e, 0x63, 0x2e, 0x31, 0x20, 0x30, 0x1e, 0x06,
67 0x03, 0x55, 0x04, 0x0b, 0x14, 0x17, 0x41, 0x70,
68 0x70, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x74, 0x65,
69 0x72, 0x6e, 0x65, 0x74, 0x20, 0x53, 0x65, 0x72,
70 0x76, 0x69, 0x63, 0x65, 0x73, 0x31, 0x33, 0x30,
71 0x31, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x14, 0x2a,
72 0x54, 0x65, 0x72, 0x6d, 0x73, 0x20, 0x6f, 0x66,
73 0x20, 0x75, 0x73, 0x65, 0x20, 0x61, 0x74, 0x20,
74 0x77, 0x77, 0x77, 0x2e, 0x76, 0x65, 0x72, 0x69,
75 0x73, 0x69, 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d,
76 0x2f, 0x72, 0x70, 0x61, 0x20, 0x28, 0x63, 0x29,
77 0x30, 0x30, 0x31, 0x18, 0x30, 0x16, 0x06, 0x03,
78 0x55, 0x04, 0x03, 0x14, 0x0f, 0x73, 0x74, 0x6f,
79 0x72, 0x65, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65,
80 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x81, 0x9f, 0x30,
81 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
82 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81,
83 0x8d, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81,
84 0x00, 0xbf, 0x8f, 0x59, 0x14, 0xbb, 0x91, 0xa4,
85 0xe6, 0x3e, 0x75, 0xf8, 0x38, 0x36, 0xfe, 0xcd,
86 0x9e, 0x5d, 0x3f, 0x14, 0x62, 0xfc, 0xe7, 0x48,
87 0x5f, 0x7e, 0x6b, 0x6e, 0x87, 0xd2, 0x31, 0x6e,
88 0x9d, 0x19, 0x92, 0x6f, 0xe3, 0xbc, 0x7e, 0x48,
89 0xb1, 0x2f, 0x9d, 0x70, 0x2c, 0x11, 0xdf, 0x35,
90 0xd1, 0xee, 0xd2, 0xd5, 0x37, 0x92, 0x4e, 0x06,
91 0x66, 0xb3, 0xc9, 0x9c, 0x99, 0xec, 0x09, 0xc6,
92 0xc4, 0xd6, 0xe6, 0x62, 0xb7, 0x97, 0x24, 0xd8,
93 0x38, 0x40, 0xf1, 0xa0, 0x1c, 0x0f, 0xf2, 0x3d,
94 0xaf, 0x4a, 0x93, 0xba, 0x11, 0xad, 0x67, 0xc4,
95 0x4b, 0x1d, 0x74, 0x33, 0x7c, 0xb9, 0x6b, 0x2d,
96 0xc5, 0x9b, 0x6a, 0xd2, 0xf2, 0x28, 0x08, 0x05,
97 0x18, 0x7d, 0xf0, 0xde, 0x28, 0x61, 0xf1, 0x81,
98 0xd5, 0x56, 0x4f, 0x20, 0x6e, 0xf3, 0x34, 0x89,
99 0x67, 0xd3, 0xa7, 0x09, 0xda, 0xc7, 0x89, 0x4d,
100 0xe1, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x82,
101 0x01, 0x79, 0x30, 0x82, 0x01, 0x75, 0x30, 0x09,
102 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x02, 0x30,
103 0x00, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f,
104 0x04, 0x04, 0x03, 0x02, 0x05, 0xa0, 0x30, 0x46,
105 0x06, 0x03, 0x55, 0x1d, 0x1f, 0x04, 0x3f, 0x30,
106 0x3d, 0x30, 0x3b, 0xa0, 0x39, 0xa0, 0x37, 0x86,
107 0x35, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f,
108 0x63, 0x72, 0x6c, 0x2e, 0x76, 0x65, 0x72, 0x69,
109 0x73, 0x69, 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d,
110 0x2f, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x33, 0x49,
111 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x69,
112 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x65, 0x72, 0x76,
113 0x65, 0x72, 0x2e, 0x63, 0x72, 0x6c, 0x30, 0x44,
114 0x06, 0x03, 0x55, 0x1d, 0x20, 0x04, 0x3d, 0x30,
115 0x3b, 0x30, 0x39, 0x06, 0x0b, 0x60, 0x86, 0x48,
116 0x01, 0x86, 0xf8, 0x45, 0x01, 0x07, 0x17, 0x03,
117 0x30, 0x2a, 0x30, 0x28, 0x06, 0x08, 0x2b, 0x06,
118 0x01, 0x05, 0x05, 0x07, 0x02, 0x01, 0x16, 0x1c,
119 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f,
120 0x77, 0x77, 0x77, 0x2e, 0x76, 0x65, 0x72, 0x69,
121 0x73, 0x69, 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d,
122 0x2f, 0x72, 0x70, 0x61, 0x30, 0x28, 0x06, 0x03,
123 0x55, 0x1d, 0x25, 0x04, 0x21, 0x30, 0x1f, 0x06,
124 0x09, 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42,
125 0x04, 0x01, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05,
126 0x05, 0x07, 0x03, 0x01, 0x06, 0x08, 0x2b, 0x06,
127 0x01, 0x05, 0x05, 0x07, 0x03, 0x02, 0x30, 0x34,
128 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07,
129 0x01, 0x01, 0x04, 0x28, 0x30, 0x26, 0x30, 0x24,
130 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07,
131 0x30, 0x01, 0x86, 0x18, 0x68, 0x74, 0x74, 0x70,
132 0x3a, 0x2f, 0x2f, 0x6f, 0x63, 0x73, 0x70, 0x2e,
133 0x76, 0x65, 0x72, 0x69, 0x73, 0x69, 0x67, 0x6e,
134 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x6d, 0x06, 0x08,
135 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x01, 0x0c,
136 0x04, 0x61, 0x30, 0x5f, 0xa1, 0x5d, 0xa0, 0x5b,
137 0x30, 0x59, 0x30, 0x57, 0x30, 0x55, 0x16, 0x09,
138 0x69, 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x67, 0x69,
139 0x66, 0x30, 0x21, 0x30, 0x1f, 0x30, 0x07, 0x06,
140 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x04, 0x14,
141 0x8f, 0xe5, 0xd3, 0x1a, 0x86, 0xac, 0x8d, 0x8e,
142 0x6b, 0xc3, 0xcf, 0x80, 0x6a, 0xd4, 0x48, 0x18,
143 0x2c, 0x7b, 0x19, 0x2e, 0x30, 0x25, 0x16, 0x23,
144 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6c,
145 0x6f, 0x67, 0x6f, 0x2e, 0x76, 0x65, 0x72, 0x69,
146 0x73, 0x69, 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d,
147 0x2f, 0x76, 0x73, 0x6c, 0x6f, 0x67, 0x6f, 0x2e,
148 0x67, 0x69, 0x66, 0x30, 0x0d, 0x06, 0x09, 0x2a,
149 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05,
150 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x01, 0x5e,
151 0x47, 0x3c, 0x5f, 0x38, 0x4f, 0x4d, 0x64, 0xf1,
152 0x33, 0x13, 0xd3, 0xcf, 0x80, 0xf9, 0x88, 0x93,
153 0xba, 0x44, 0x7b, 0xf0, 0xbd, 0x60, 0x96, 0x39,
154 0xa8, 0xc5, 0x76, 0x18, 0x01, 0xa7, 0x03, 0x53,
155 0x8b, 0x92, 0xda, 0x97, 0xaa, 0x85, 0xc7, 0xb7,
156 0x7d, 0x58, 0x83, 0x68, 0x4a, 0xd9, 0x54, 0x78,
157 0x7f, 0xa0, 0xe9, 0x8f, 0xc5, 0xb4, 0x3a, 0xb7,
158 0x3c, 0xa1, 0x70, 0x40, 0xac, 0xc2, 0xc6, 0x5b,
159 0xbd, 0x70, 0x90, 0xb9, 0xc6, 0x7d, 0x7e, 0x49,
160 0xe4, 0xbd, 0xc1, 0x5d, 0x1a, 0x0f, 0x9e, 0x0a,
161 0x93, 0xfd, 0xc7, 0x7a, 0x8b, 0x9c, 0x61, 0x61,
162 0x34, 0x02, 0xcc, 0x68, 0xdd, 0x2b, 0x29, 0xbc,
163 0x83, 0x8d, 0x7a, 0x8b, 0x22, 0xb9, 0x1e, 0x79,
164 0x3a, 0x5a, 0xc6, 0xda, 0xb3, 0xaf, 0xaf, 0x0b,
165 0x41, 0x16, 0xda, 0xd2, 0x8e, 0xcd, 0xc1, 0xc0,
166 0x43, 0xfc, 0xb3, 0x10, 0xb7, 0x27
167 };
168
169 static const uint8_t _c0_serial[] = {
170 0x44, 0x50, 0xE6, 0x23, 0xF5, 0x7E, 0x73, 0x4F,
171 0xF8, 0x5C, 0x1D, 0xEE, 0xFB, 0x97, 0x6C, 0x86
172 };
173
174 /*
175 subject= /O=VeriSign Trust Network/OU=VeriSign, Inc./OU=VeriSign International Server CA - Class 3/OU=www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign
176 issuer= /C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority
177 serial=254B8A853842CCE358F8C5DDAE226EA4
178 */
179 static const uint8_t _c1[] = {
180 0x30, 0x82, 0x03, 0x83, 0x30, 0x82, 0x02, 0xec,
181 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x25,
182 0x4b, 0x8a, 0x85, 0x38, 0x42, 0xcc, 0xe3, 0x58,
183 0xf8, 0xc5, 0xdd, 0xae, 0x22, 0x6e, 0xa4, 0x30,
184 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
185 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x5f,
186 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
187 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x17, 0x30,
188 0x15, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x0e,
189 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6e,
190 0x2c, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x31, 0x37,
191 0x30, 0x35, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13,
192 0x2e, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x20, 0x33,
193 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20,
194 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x20,
195 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63,
196 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x41, 0x75,
197 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x30,
198 0x1e, 0x17, 0x0d, 0x39, 0x37, 0x30, 0x34, 0x31,
199 0x37, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a,
200 0x17, 0x0d, 0x31, 0x31, 0x31, 0x30, 0x32, 0x34,
201 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30,
202 0x81, 0xba, 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x03,
203 0x55, 0x04, 0x0a, 0x13, 0x16, 0x56, 0x65, 0x72,
204 0x69, 0x53, 0x69, 0x67, 0x6e, 0x20, 0x54, 0x72,
205 0x75, 0x73, 0x74, 0x20, 0x4e, 0x65, 0x74, 0x77,
206 0x6f, 0x72, 0x6b, 0x31, 0x17, 0x30, 0x15, 0x06,
207 0x03, 0x55, 0x04, 0x0b, 0x13, 0x0e, 0x56, 0x65,
208 0x72, 0x69, 0x53, 0x69, 0x67, 0x6e, 0x2c, 0x20,
209 0x49, 0x6e, 0x63, 0x2e, 0x31, 0x33, 0x30, 0x31,
210 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x2a, 0x56,
211 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6e, 0x20,
212 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74,
213 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x20, 0x53, 0x65,
214 0x72, 0x76, 0x65, 0x72, 0x20, 0x43, 0x41, 0x20,
215 0x2d, 0x20, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x20,
216 0x33, 0x31, 0x49, 0x30, 0x47, 0x06, 0x03, 0x55,
217 0x04, 0x0b, 0x13, 0x40, 0x77, 0x77, 0x77, 0x2e,
218 0x76, 0x65, 0x72, 0x69, 0x73, 0x69, 0x67, 0x6e,
219 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x43, 0x50, 0x53,
220 0x20, 0x49, 0x6e, 0x63, 0x6f, 0x72, 0x70, 0x2e,
221 0x62, 0x79, 0x20, 0x52, 0x65, 0x66, 0x2e, 0x20,
222 0x4c, 0x49, 0x41, 0x42, 0x49, 0x4c, 0x49, 0x54,
223 0x59, 0x20, 0x4c, 0x54, 0x44, 0x2e, 0x28, 0x63,
224 0x29, 0x39, 0x37, 0x20, 0x56, 0x65, 0x72, 0x69,
225 0x53, 0x69, 0x67, 0x6e, 0x30, 0x81, 0x9f, 0x30,
226 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
227 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81,
228 0x8d, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81,
229 0x00, 0xd8, 0x82, 0x80, 0xe8, 0xd6, 0x19, 0x02,
230 0x7d, 0x1f, 0x85, 0x18, 0x39, 0x25, 0xa2, 0x65,
231 0x2b, 0xe1, 0xbf, 0xd4, 0x05, 0xd3, 0xbc, 0xe6,
232 0x36, 0x3b, 0xaa, 0xf0, 0x4c, 0x6c, 0x5b, 0xb6,
233 0xe7, 0xaa, 0x3c, 0x73, 0x45, 0x55, 0xb2, 0xf1,
234 0xbd, 0xea, 0x97, 0x42, 0xed, 0x9a, 0x34, 0x0a,
235 0x15, 0xd4, 0xa9, 0x5c, 0xf5, 0x40, 0x25, 0xdd,
236 0xd9, 0x07, 0xc1, 0x32, 0xb2, 0x75, 0x6c, 0xc4,
237 0xca, 0xbb, 0xa3, 0xfe, 0x56, 0x27, 0x71, 0x43,
238 0xaa, 0x63, 0xf5, 0x30, 0x3e, 0x93, 0x28, 0xe5,
239 0xfa, 0xf1, 0x09, 0x3b, 0xf3, 0xb7, 0x4d, 0x4e,
240 0x39, 0xf7, 0x5c, 0x49, 0x5a, 0xb8, 0xc1, 0x1d,
241 0xd3, 0xb2, 0x8a, 0xfe, 0x70, 0x30, 0x95, 0x42,
242 0xcb, 0xfe, 0x2b, 0x51, 0x8b, 0x5a, 0x3c, 0x3a,
243 0xf9, 0x22, 0x4f, 0x90, 0xb2, 0x02, 0xa7, 0x53,
244 0x9c, 0x4f, 0x34, 0xe7, 0xab, 0x04, 0xb2, 0x7b,
245 0x6f, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x81,
246 0xe3, 0x30, 0x81, 0xe0, 0x30, 0x0f, 0x06, 0x03,
247 0x55, 0x1d, 0x13, 0x04, 0x08, 0x30, 0x06, 0x01,
248 0x01, 0xff, 0x02, 0x01, 0x00, 0x30, 0x44, 0x06,
249 0x03, 0x55, 0x1d, 0x20, 0x04, 0x3d, 0x30, 0x3b,
250 0x30, 0x39, 0x06, 0x0b, 0x60, 0x86, 0x48, 0x01,
251 0x86, 0xf8, 0x45, 0x01, 0x07, 0x01, 0x01, 0x30,
252 0x2a, 0x30, 0x28, 0x06, 0x08, 0x2b, 0x06, 0x01,
253 0x05, 0x05, 0x07, 0x02, 0x01, 0x16, 0x1c, 0x68,
254 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x77,
255 0x77, 0x77, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x73,
256 0x69, 0x67, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
257 0x43, 0x50, 0x53, 0x30, 0x34, 0x06, 0x03, 0x55,
258 0x1d, 0x25, 0x04, 0x2d, 0x30, 0x2b, 0x06, 0x08,
259 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01,
260 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07,
261 0x03, 0x02, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01,
262 0x86, 0xf8, 0x42, 0x04, 0x01, 0x06, 0x0a, 0x60,
263 0x86, 0x48, 0x01, 0x86, 0xf8, 0x45, 0x01, 0x08,
264 0x01, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f,
265 0x04, 0x04, 0x03, 0x02, 0x01, 0x06, 0x30, 0x11,
266 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8,
267 0x42, 0x01, 0x01, 0x04, 0x04, 0x03, 0x02, 0x01,
268 0x06, 0x30, 0x31, 0x06, 0x03, 0x55, 0x1d, 0x1f,
269 0x04, 0x2a, 0x30, 0x28, 0x30, 0x26, 0xa0, 0x24,
270 0xa0, 0x22, 0x86, 0x20, 0x68, 0x74, 0x74, 0x70,
271 0x3a, 0x2f, 0x2f, 0x63, 0x72, 0x6c, 0x2e, 0x76,
272 0x65, 0x72, 0x69, 0x73, 0x69, 0x67, 0x6e, 0x2e,
273 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x63, 0x61, 0x33,
274 0x2e, 0x63, 0x72, 0x6c, 0x30, 0x0d, 0x06, 0x09,
275 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
276 0x05, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x08,
277 0x01, 0xec, 0xe4, 0x68, 0x94, 0x03, 0x42, 0xf1,
278 0x73, 0xf1, 0x23, 0xa2, 0x3a, 0xde, 0xe9, 0xf1,
279 0xda, 0xc6, 0x54, 0xc4, 0x23, 0x3e, 0x86, 0xea,
280 0xcf, 0x6a, 0x3a, 0x33, 0xab, 0xea, 0x9c, 0x04,
281 0x14, 0x07, 0x36, 0x06, 0x0b, 0xf9, 0x88, 0x6f,
282 0xd5, 0x13, 0xee, 0x29, 0x2b, 0xc3, 0xe4, 0x72,
283 0x8d, 0x44, 0xed, 0xd1, 0xac, 0x20, 0x09, 0x2d,
284 0xe1, 0xf6, 0xe1, 0x19, 0x05, 0x38, 0xb0, 0x3d,
285 0x0f, 0x9f, 0x7f, 0xf8, 0x9e, 0x02, 0xdc, 0x86,
286 0x02, 0x86, 0x61, 0x4e, 0x26, 0x5f, 0x5e, 0x9f,
287 0x92, 0x1e, 0x0c, 0x24, 0xa4, 0xf5, 0xd0, 0x70,
288 0x13, 0xcf, 0x26, 0xc3, 0x43, 0x3d, 0x49, 0x1d,
289 0x9e, 0x82, 0x2e, 0x52, 0x5f, 0xbc, 0x3e, 0xc6,
290 0x66, 0x29, 0x01, 0x8e, 0x4e, 0x92, 0x2c, 0xbc,
291 0x46, 0x75, 0x03, 0x82, 0xac, 0x73, 0xe9, 0xd9,
292 0x7e, 0x0b, 0x67, 0xef, 0x54, 0x52, 0x1a
293 };
294
295 #define CFReleaseSafe(CF) { CFTypeRef _cf = (CF); if (_cf) CFRelease(_cf); }
296
297 /* Test basic add delete update copy matching stuff. */
298 static void tests(void)
299 {
300 SecTrustRef trust;
301 SecCertificateRef cert0, cert1;
302 isnt(cert0 = SecCertificateCreateWithBytes(NULL, _c0, sizeof(_c0)),
303 NULL, "create cert0");
304 isnt(cert1 = SecCertificateCreateWithBytes(NULL, _c1, sizeof(_c1)),
305 NULL, "create cert1");
306 const void *v_certs[] = {
307 cert0,
308 cert1
309 };
310 SecPolicyRef policy = SecPolicyCreateSSL(false, CFSTR("store.apple.com"));
311 CFArrayRef certs = CFArrayCreate(NULL, v_certs,
312 array_size(v_certs), NULL);
313 ok_status(SecTrustCreateWithCertificates(certs, policy, &trust), "create trust");
314 /* Jan 1st 2006. */
315 CFDateRef date = CFDateCreate(NULL, 157680000.0);
316 ok_status(SecTrustSetVerifyDate(trust, date), "set date");
317
318 SecTrustResultType trustResult;
319 ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
320 is_status(trustResult, kSecTrustResultUnspecified,
321 "trust is kSecTrustResultUnspecified");
322 CFDataRef exceptions;
323 ok(exceptions = SecTrustCopyExceptions(trust), "create an exceptions");
324 ok(SecTrustSetExceptions(trust, exceptions), "set exceptions");
325 ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
326 is_status(trustResult, kSecTrustResultProceed, "trust is kSecTrustResultProceed");
327
328 CFReleaseSafe(trust);
329 CFReleaseSafe(policy);
330 policy = SecPolicyCreateSSL(false, CFSTR("badstore.apple.com"));
331 ok_status(SecTrustCreateWithCertificates(certs, policy, &trust), "create trust with hostname mismatch");
332 ok_status(SecTrustSetVerifyDate(trust, date), "set date");
333 ok(SecTrustSetExceptions(trust, exceptions), "set old exceptions");
334 ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
335 is_status(trustResult, kSecTrustResultRecoverableTrustFailure, "trust is kSecTrustResultRecoverableTrustFailure");
336 CFReleaseSafe(exceptions);
337 ok(exceptions = SecTrustCopyExceptions(trust), "create a new exceptions");
338 ok(SecTrustSetExceptions(trust, exceptions), "set exceptions");
339 ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
340 is_status(trustResult, kSecTrustResultProceed, "trust is kSecTrustResultProceed");
341
342 CFReleaseSafe(trust);
343 ok_status(SecTrustCreateWithCertificates(certs, policy, &trust), "create trust");
344 ok_status(SecTrustSetVerifyDate(trust, date), "set date");
345 ok(SecTrustSetExceptions(trust, exceptions), "set exceptions");
346 ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
347 is_status(trustResult, kSecTrustResultProceed, "trust is kSecTrustResultProceed");
348 CFArrayRef anchors = CFArrayCreate(kCFAllocatorDefault, NULL, 0, &kCFTypeArrayCallBacks);
349 ok_status(SecTrustSetAnchorCertificates(trust, anchors), "set empty anchor list");
350 ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
351 is_status(trustResult, kSecTrustResultRecoverableTrustFailure, "trust is kSecTrustResultRecoverableTrustFailure");
352
353 ok_status(SecTrustSetAnchorCertificatesOnly(trust, false), "trust passed in anchors and system anchors");
354 ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
355 is_status(trustResult, kSecTrustResultProceed, "trust is now kSecTrustResultProceed");
356
357 ok_status(SecTrustSetAnchorCertificatesOnly(trust, true), "only trust passed in anchors (default)");
358 ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
359 is_status(trustResult, kSecTrustResultRecoverableTrustFailure, "trust is kSecTrustResultRecoverableTrustFailure again");
360
361 CFReleaseSafe(exceptions);
362 ok(exceptions = SecTrustCopyExceptions(trust), "create a new exceptions");
363 ok(SecTrustSetExceptions(trust, exceptions), "set exceptions");
364 ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
365 is_status(trustResult, kSecTrustResultProceed, "trust is kSecTrustResultProceed");
366 CFReleaseSafe(date);
367 date = CFDateCreate(NULL, 667680000.0);
368 ok_status(SecTrustSetVerifyDate(trust, date), "set date to far future so certs are expired");
369 ok_status(SecTrustEvaluate(trust, &trustResult), "evaluate trust");
370 is_status(trustResult, kSecTrustResultRecoverableTrustFailure, "trust is kSecTrustResultRecoverableTrustFailure");
371
372 CFReleaseSafe(anchors);
373 CFReleaseSafe(exceptions);
374 CFReleaseSafe(trust);
375 CFReleaseSafe(policy);
376 CFReleaseSafe(certs);
377 CFReleaseSafe(cert0);
378 CFReleaseSafe(cert1);
379 CFReleaseSafe(date);
380 }
381
382 int si_27_sectrust_exceptions(int argc, char *const *argv)
383 {
384 plan_tests(40);
385
386
387 tests();
388
389 return 0;
390 }