]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_smime/regressions/smime-cms-test.c
Security-58286.1.32.tar.gz
[apple/security.git] / OSX / libsecurity_smime / regressions / smime-cms-test.c
1 /*
2 * Copyright (c) 2008-2014 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24
25 #include <regressions/test/testmore.h>
26 #include <Security/SecCMS.h>
27 #include <Security/SecItem.h>
28 #include <Security/SecItemPriv.h>
29 #include <Security/SecPolicyPriv.h>
30 #include <Security/SecBasePriv.h>
31 #include <Security/SecCertificatePriv.h>
32 #include <Security/SecIdentityPriv.h>
33 #include <Security/SecCertificateRequest.h>
34 #include <utilities/array_size.h>
35 #include <utilities/SecCFRelease.h>
36
37 #include <stdlib.h>
38 #include <unistd.h>
39
40 int smime_cms_test(int argc, char *const *argv);
41
42 /*
43 Bag Attributes
44 friendlyName: uranusLeaf
45 localKeyID: 46 E0 8A 05 63 4D 17 3F CA A4 AA B6 5A DA CF BA 84 22 7C 23
46 subject=/CN=uranusLeaf/emailAddress=uranus@uranus.com
47 issuer=/CN=plutoCA/emailAddress=pluto@pluto.com
48 */
49 static const uint8_t _c1[] = {
50 0x30, 0x82, 0x02, 0xe0, 0x30, 0x82, 0x01, 0xc8,
51 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x01, 0x02,
52 0x30, 0x0b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
53 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x30, 0x32, 0x31,
54 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x03,
55 0x0c, 0x07, 0x70, 0x6c, 0x75, 0x74, 0x6f, 0x43,
56 0x41, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x09, 0x2a,
57 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01,
58 0x0c, 0x0f, 0x70, 0x6c, 0x75, 0x74, 0x6f, 0x40,
59 0x70, 0x6c, 0x75, 0x74, 0x6f, 0x2e, 0x63, 0x6f,
60 0x6d, 0x30, 0x1e, 0x17, 0x0d, 0x30, 0x35, 0x31,
61 0x32, 0x31, 0x37, 0x30, 0x30, 0x30, 0x34, 0x32,
62 0x35, 0x5a, 0x17, 0x0d, 0x30, 0x36, 0x31, 0x32,
63 0x31, 0x37, 0x30, 0x30, 0x30, 0x34, 0x32, 0x35,
64 0x5a, 0x30, 0x37, 0x31, 0x13, 0x30, 0x11, 0x06,
65 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0a, 0x75, 0x72,
66 0x61, 0x6e, 0x75, 0x73, 0x4c, 0x65, 0x61, 0x66,
67 0x31, 0x20, 0x30, 0x1e, 0x06, 0x09, 0x2a, 0x86,
68 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x0c,
69 0x11, 0x75, 0x72, 0x61, 0x6e, 0x75, 0x73, 0x40,
70 0x75, 0x72, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63,
71 0x6f, 0x6d, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d,
72 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
73 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01,
74 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82,
75 0x01, 0x01, 0x00, 0xa6, 0x82, 0x8e, 0xc6, 0x7e,
76 0xc9, 0x8c, 0x99, 0x6f, 0xb0, 0x62, 0x32, 0x35,
77 0xe7, 0xdb, 0xff, 0x34, 0x84, 0xdc, 0x72, 0xa8,
78 0xef, 0x22, 0x6f, 0x93, 0x63, 0x64, 0x80, 0x80,
79 0x5d, 0x50, 0x7e, 0xb4, 0x2e, 0x1b, 0x93, 0x93,
80 0x49, 0xca, 0xae, 0xcd, 0x34, 0x44, 0x4b, 0xd7,
81 0xfa, 0x9f, 0x3c, 0xfc, 0x9e, 0x65, 0xa9, 0xfb,
82 0x5e, 0x5d, 0x18, 0xa3, 0xf8, 0xb0, 0x08, 0xac,
83 0x8f, 0xfd, 0x03, 0xcb, 0xbd, 0x7f, 0xa0, 0x2a,
84 0xa6, 0xea, 0xca, 0xa3, 0x24, 0xef, 0x7c, 0xc3,
85 0xeb, 0x95, 0xcb, 0x90, 0x3f, 0x5e, 0xde, 0x78,
86 0xf2, 0x3d, 0x32, 0x72, 0xdb, 0x33, 0x6e, 0x9b,
87 0x52, 0x9f, 0x0c, 0x60, 0x4a, 0x24, 0xa1, 0xf6,
88 0x3b, 0x80, 0xbd, 0xa1, 0xdc, 0x40, 0x03, 0xe7,
89 0xa0, 0x59, 0x1f, 0xdb, 0xb4, 0xed, 0x57, 0xdc,
90 0x74, 0x0d, 0x99, 0x5a, 0x12, 0x74, 0x64, 0xaa,
91 0xb6, 0xa5, 0x96, 0x75, 0xf9, 0x42, 0x43, 0xe2,
92 0x52, 0xc2, 0x57, 0x23, 0x75, 0xd7, 0xa9, 0x4f,
93 0x07, 0x32, 0x99, 0xbd, 0x3d, 0x44, 0xbd, 0x04,
94 0x62, 0xe5, 0xb7, 0x2c, 0x0c, 0x11, 0xc5, 0xb2,
95 0x2e, 0xc4, 0x12, 0x1d, 0x7f, 0x42, 0x1e, 0x71,
96 0xaf, 0x39, 0x2b, 0x78, 0x47, 0x92, 0x23, 0x44,
97 0xef, 0xe3, 0xc1, 0x47, 0x69, 0x5a, 0xf1, 0x48,
98 0xaa, 0x37, 0xa4, 0x94, 0x6b, 0x96, 0xe5, 0x4b,
99 0xfd, 0x05, 0xc7, 0x9c, 0xcc, 0x38, 0xd1, 0x47,
100 0x85, 0x60, 0x7f, 0xef, 0xe9, 0x2e, 0x25, 0x08,
101 0xf8, 0x7d, 0x98, 0xdd, 0x6c, 0xeb, 0x4a, 0x32,
102 0x33, 0x44, 0x0b, 0x61, 0xb3, 0xf9, 0xae, 0x26,
103 0x41, 0xb5, 0x38, 0xdb, 0xcf, 0x13, 0x72, 0x23,
104 0x5b, 0x66, 0x20, 0x86, 0x4d, 0x24, 0xc2, 0xd4,
105 0x94, 0xde, 0xe3, 0x24, 0xb7, 0xcd, 0x75, 0x9e,
106 0x1d, 0x9f, 0xbc, 0xd0, 0x60, 0x34, 0x7d, 0xf8,
107 0xcb, 0x41, 0x39, 0x02, 0x03, 0x01, 0x00, 0x01,
108 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
109 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03,
110 0x82, 0x01, 0x01, 0x00, 0x17, 0xa5, 0x22, 0xed,
111 0xb8, 0x3e, 0x1f, 0x11, 0x99, 0xc5, 0xba, 0x28,
112 0x3e, 0x7e, 0xa6, 0xeb, 0x02, 0x81, 0x06, 0xa1,
113 0xc6, 0x80, 0xb9, 0x7e, 0x5c, 0x5a, 0x63, 0xe0,
114 0x8d, 0xeb, 0xd0, 0xec, 0x9c, 0x3a, 0x94, 0x64,
115 0x7c, 0x13, 0x54, 0x0d, 0xd6, 0xe3, 0x27, 0x88,
116 0xa6, 0xd2, 0x4b, 0x36, 0xdd, 0x2e, 0xfa, 0x94,
117 0xe5, 0x03, 0x27, 0xc9, 0xa6, 0x31, 0x02, 0xea,
118 0x40, 0x77, 0x2e, 0x93, 0xc4, 0x4d, 0xe2, 0x70,
119 0xe2, 0x67, 0x1c, 0xa8, 0x0d, 0xcd, 0x1a, 0x72,
120 0x86, 0x2c, 0xea, 0xdc, 0x7f, 0x8c, 0x49, 0x2c,
121 0xe7, 0x99, 0x13, 0xda, 0x3f, 0x58, 0x9e, 0xf5,
122 0x4d, 0x3c, 0x8c, 0x1c, 0xed, 0x85, 0xa7, 0xe2,
123 0xae, 0xda, 0x5f, 0xbe, 0x36, 0x1c, 0x9f, 0x5a,
124 0xa0, 0xdc, 0x2a, 0xc0, 0xee, 0x71, 0x07, 0x26,
125 0x8b, 0xe8, 0x8a, 0xf8, 0x2d, 0x36, 0x78, 0xc9,
126 0x79, 0xfa, 0xbe, 0x98, 0x59, 0x95, 0x12, 0x24,
127 0xf1, 0xda, 0x20, 0xc7, 0x78, 0xf9, 0x7c, 0x6a,
128 0x24, 0x43, 0x82, 0xa8, 0x0f, 0xb1, 0x7d, 0x94,
129 0xaa, 0x30, 0x35, 0xe5, 0x69, 0xdc, 0x0a, 0x0e,
130 0xaf, 0x10, 0x5e, 0x1a, 0x81, 0x50, 0x5c, 0x7e,
131 0x24, 0xb3, 0x07, 0x65, 0x4b, 0xc1, 0x7e, 0xc6,
132 0x38, 0xdb, 0xd3, 0x6a, 0xf0, 0xd8, 0x85, 0x61,
133 0x9a, 0x9f, 0xfe, 0x02, 0x46, 0x29, 0xb2, 0x9a,
134 0xe2, 0x04, 0xe7, 0x72, 0xcc, 0x87, 0x46, 0xba,
135 0x7d, 0xa8, 0xf9, 0xd0, 0x0f, 0x29, 0xfc, 0xfd,
136 0xd1, 0xd0, 0x7f, 0x36, 0xc1, 0xd8, 0x7d, 0x88,
137 0x03, 0x62, 0xf5, 0x8c, 0x00, 0xb5, 0xc2, 0x81,
138 0x44, 0x67, 0x58, 0x11, 0xb4, 0x3a, 0xbb, 0xd1,
139 0x8c, 0x94, 0x20, 0x60, 0xea, 0xa0, 0xac, 0xc1,
140 0xf1, 0x08, 0x54, 0xb8, 0xf6, 0x5e, 0xac, 0xf1,
141 0xec, 0x78, 0x69, 0x9d, 0x7e, 0x4d, 0x06, 0x3b,
142 0x9b, 0x78, 0x78, 0x10
143 };
144
145 /* A certs only cms message. */
146 static UInt8 certsOnlyMsg[] = {
147 0x30, 0x82, 0x04, 0xdc, 0x06, 0x09, 0x2a, 0x86,
148 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0,
149 0x82, 0x04, 0xcd, 0x30, 0x82, 0x04, 0xc9, 0x02,
150 0x01, 0x01, 0x31, 0x00, 0x30, 0x0b, 0x06, 0x09,
151 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07,
152 0x01, 0xa0, 0x82, 0x04, 0xb1, 0x30, 0x82, 0x04,
153 0xad, 0x30, 0x82, 0x03, 0x95, 0xa0, 0x03, 0x02,
154 0x01, 0x02, 0x02, 0x10, 0x4e, 0x2d, 0x47, 0x54,
155 0xcd, 0xbb, 0x8e, 0x98, 0x42, 0xdb, 0x18, 0x9e,
156 0x3a, 0xca, 0x80, 0xcc, 0x30, 0x0d, 0x06, 0x09,
157 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
158 0x05, 0x05, 0x00, 0x30, 0x57, 0x31, 0x13, 0x30,
159 0x11, 0x06, 0x0a, 0x09, 0x92, 0x26, 0x89, 0x93,
160 0xf2, 0x2c, 0x64, 0x01, 0x19, 0x16, 0x03, 0x63,
161 0x6f, 0x6d, 0x31, 0x15, 0x30, 0x13, 0x06, 0x0a,
162 0x09, 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64,
163 0x01, 0x19, 0x16, 0x05, 0x61, 0x70, 0x70, 0x6c,
164 0x65, 0x31, 0x17, 0x30, 0x15, 0x06, 0x0a, 0x09,
165 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64, 0x01,
166 0x19, 0x16, 0x07, 0x63, 0x61, 0x6c, 0x6c, 0x69,
167 0x65, 0x39, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03,
168 0x55, 0x04, 0x03, 0x13, 0x07, 0x63, 0x61, 0x6c,
169 0x6c, 0x69, 0x65, 0x39, 0x30, 0x1e, 0x17, 0x0d,
170 0x30, 0x34, 0x30, 0x32, 0x32, 0x34, 0x31, 0x39,
171 0x31, 0x35, 0x35, 0x37, 0x5a, 0x17, 0x0d, 0x30,
172 0x39, 0x30, 0x32, 0x32, 0x34, 0x31, 0x39, 0x32,
173 0x35, 0x30, 0x31, 0x5a, 0x30, 0x57, 0x31, 0x13,
174 0x30, 0x11, 0x06, 0x0a, 0x09, 0x92, 0x26, 0x89,
175 0x93, 0xf2, 0x2c, 0x64, 0x01, 0x19, 0x16, 0x03,
176 0x63, 0x6f, 0x6d, 0x31, 0x15, 0x30, 0x13, 0x06,
177 0x0a, 0x09, 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c,
178 0x64, 0x01, 0x19, 0x16, 0x05, 0x61, 0x70, 0x70,
179 0x6c, 0x65, 0x31, 0x17, 0x30, 0x15, 0x06, 0x0a,
180 0x09, 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64,
181 0x01, 0x19, 0x16, 0x07, 0x63, 0x61, 0x6c, 0x6c,
182 0x69, 0x65, 0x39, 0x31, 0x10, 0x30, 0x0e, 0x06,
183 0x03, 0x55, 0x04, 0x03, 0x13, 0x07, 0x63, 0x61,
184 0x6c, 0x6c, 0x69, 0x65, 0x39, 0x30, 0x82, 0x01,
185 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48,
186 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00,
187 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01,
188 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0x9d, 0xbf,
189 0x50, 0x9c, 0x42, 0xea, 0xad, 0xfa, 0xb7, 0x3e,
190 0x22, 0xcf, 0xc5, 0xba, 0xd3, 0x3a, 0xe8, 0x62,
191 0xb5, 0x62, 0x3d, 0x1e, 0xcf, 0xec, 0x52, 0x48,
192 0x51, 0xa0, 0xef, 0x20, 0xf2, 0x7b, 0xb2, 0x57,
193 0x25, 0x86, 0xd7, 0x15, 0xd8, 0xc6, 0x1a, 0x5f,
194 0x95, 0xe0, 0x35, 0x97, 0x23, 0x7c, 0xc6, 0x88,
195 0x11, 0x1c, 0x8d, 0x8d, 0x7d, 0xf0, 0xc0, 0xbd,
196 0x71, 0x49, 0xbd, 0x9e, 0x51, 0x02, 0x3c, 0x70,
197 0xd7, 0xaa, 0xd2, 0x80, 0xb4, 0xda, 0xb0, 0x3b,
198 0x42, 0x16, 0x50, 0xc6, 0x1b, 0x17, 0x29, 0xd6,
199 0xbe, 0x40, 0xce, 0x3c, 0x54, 0xaf, 0xf5, 0x29,
200 0xc6, 0x12, 0x47, 0xc4, 0x96, 0x85, 0x46, 0xaa,
201 0xf1, 0x76, 0xd1, 0x76, 0x22, 0xd3, 0x45, 0xf7,
202 0x71, 0xea, 0x4b, 0x42, 0x7b, 0x97, 0x39, 0x02,
203 0x2c, 0x6d, 0x36, 0x2a, 0x80, 0xaa, 0x01, 0x58,
204 0xbc, 0x52, 0xa2, 0xa4, 0xc4, 0x3c, 0xe8, 0xcd,
205 0xb2, 0xb8, 0x4a, 0xd3, 0x4e, 0x06, 0xcc, 0x52,
206 0x0f, 0x5e, 0xd2, 0xe9, 0xe9, 0xb8, 0xe6, 0x79,
207 0xe3, 0x91, 0x24, 0x72, 0x44, 0x65, 0x3c, 0xfe,
208 0x01, 0x69, 0x70, 0x0a, 0xce, 0xd1, 0x9a, 0xd1,
209 0x3f, 0x77, 0xa6, 0x78, 0x04, 0x9b, 0x7b, 0x14,
210 0x37, 0x71, 0x3d, 0x4b, 0x56, 0xe9, 0xc3, 0xf6,
211 0x58, 0x16, 0x0c, 0x10, 0x86, 0x5b, 0xbd, 0x93,
212 0xc0, 0xf5, 0xb8, 0xbb, 0x78, 0xcf, 0xf3, 0xb2,
213 0xaa, 0xaf, 0xc4, 0x0c, 0x66, 0x13, 0x1d, 0xce,
214 0x98, 0x4e, 0x99, 0x93, 0xb6, 0xf7, 0xe0, 0x73,
215 0xb6, 0x74, 0x55, 0xcf, 0x83, 0x1d, 0x8d, 0x68,
216 0xcf, 0x59, 0x5e, 0x1b, 0x3e, 0xb5, 0x5a, 0x71,
217 0x36, 0x07, 0xb6, 0xfa, 0xc4, 0x6f, 0xe5, 0x7b,
218 0x69, 0x09, 0xe7, 0xe5, 0xce, 0x8a, 0x1c, 0xfa,
219 0x5c, 0xdc, 0x5d, 0x18, 0xf4, 0x5a, 0x5b, 0x0d,
220 0x37, 0x44, 0x56, 0x9e, 0xe9, 0x95, 0x02, 0x03,
221 0x01, 0x00, 0x01, 0xa3, 0x82, 0x01, 0x73, 0x30,
222 0x82, 0x01, 0x6f, 0x30, 0x0b, 0x06, 0x03, 0x55,
223 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x01, 0x86,
224 0x30, 0x0f, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01,
225 0x01, 0xff, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01,
226 0xff, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e,
227 0x04, 0x16, 0x04, 0x14, 0x6c, 0xde, 0x50, 0x56,
228 0x01, 0x34, 0xdc, 0x26, 0xec, 0x85, 0xdf, 0xf7,
229 0x32, 0x67, 0x68, 0x08, 0x04, 0xa0, 0xa8, 0xcd,
230 0x30, 0x82, 0x01, 0x1c, 0x06, 0x03, 0x55, 0x1d,
231 0x1f, 0x04, 0x82, 0x01, 0x13, 0x30, 0x82, 0x01,
232 0x0f, 0x30, 0x82, 0x01, 0x0b, 0xa0, 0x82, 0x01,
233 0x07, 0xa0, 0x82, 0x01, 0x03, 0x86, 0x81, 0xbf,
234 0x6c, 0x64, 0x61, 0x70, 0x3a, 0x2f, 0x2f, 0x2f,
235 0x43, 0x4e, 0x3d, 0x63, 0x61, 0x6c, 0x6c, 0x69,
236 0x65, 0x39, 0x2c, 0x43, 0x4e, 0x3d, 0x63, 0x68,
237 0x72, 0x69, 0x73, 0x74, 0x6f, 0x70, 0x2d, 0x6d,
238 0x74, 0x33, 0x71, 0x66, 0x6f, 0x2c, 0x43, 0x4e,
239 0x3d, 0x43, 0x44, 0x50, 0x2c, 0x43, 0x4e, 0x3d,
240 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x25, 0x32,
241 0x30, 0x4b, 0x65, 0x79, 0x25, 0x32, 0x30, 0x53,
242 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2c,
243 0x43, 0x4e, 0x3d, 0x53, 0x65, 0x72, 0x76, 0x69,
244 0x63, 0x65, 0x73, 0x2c, 0x43, 0x4e, 0x3d, 0x43,
245 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61,
246 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x44, 0x43, 0x3d,
247 0x63, 0x61, 0x6c, 0x6c, 0x69, 0x65, 0x39, 0x2c,
248 0x44, 0x43, 0x3d, 0x61, 0x70, 0x70, 0x6c, 0x65,
249 0x2c, 0x44, 0x43, 0x3d, 0x63, 0x6f, 0x6d, 0x3f,
250 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63,
251 0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x6f, 0x63,
252 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73,
253 0x74, 0x3f, 0x62, 0x61, 0x73, 0x65, 0x3f, 0x6f,
254 0x62, 0x6a, 0x65, 0x63, 0x74, 0x43, 0x6c, 0x61,
255 0x73, 0x73, 0x3d, 0x63, 0x52, 0x4c, 0x44, 0x69,
256 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69,
257 0x6f, 0x6e, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x86,
258 0x3f, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f,
259 0x63, 0x68, 0x72, 0x69, 0x73, 0x74, 0x6f, 0x70,
260 0x2d, 0x6d, 0x74, 0x33, 0x71, 0x66, 0x6f, 0x2e,
261 0x63, 0x61, 0x6c, 0x6c, 0x69, 0x65, 0x39, 0x2e,
262 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f,
263 0x6d, 0x2f, 0x43, 0x65, 0x72, 0x74, 0x45, 0x6e,
264 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x63, 0x61, 0x6c,
265 0x6c, 0x69, 0x65, 0x39, 0x2e, 0x63, 0x72, 0x6c,
266 0x30, 0x10, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04,
267 0x01, 0x82, 0x37, 0x15, 0x01, 0x04, 0x03, 0x02,
268 0x01, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86,
269 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05,
270 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x9d, 0xba,
271 0x9a, 0xeb, 0x1d, 0x78, 0x99, 0x93, 0xc6, 0x2c,
272 0x36, 0x16, 0xa0, 0x15, 0x18, 0xe8, 0x20, 0x2e,
273 0xb2, 0x0a, 0x8c, 0x02, 0x2e, 0x69, 0xe3, 0x9c,
274 0x03, 0x26, 0x56, 0x41, 0xdd, 0x5a, 0xe1, 0x49,
275 0x38, 0x5d, 0xf8, 0x1d, 0x09, 0x57, 0x22, 0xad,
276 0xd9, 0xf4, 0x47, 0xa4, 0x0a, 0x46, 0xd7, 0x13,
277 0xda, 0x08, 0xa1, 0x2c, 0xff, 0xb3, 0xbd, 0x07,
278 0xfa, 0x95, 0x98, 0x0f, 0x53, 0x40, 0x79, 0xb2,
279 0xf7, 0x85, 0x67, 0xf6, 0x37, 0x7f, 0xec, 0x21,
280 0xf6, 0xb4, 0x6c, 0xda, 0x93, 0x03, 0x32, 0x74,
281 0x5a, 0xa8, 0x81, 0x86, 0x10, 0xb7, 0x55, 0x11,
282 0xe7, 0x53, 0xc3, 0x0a, 0x7e, 0x47, 0xba, 0xf5,
283 0x8a, 0xaa, 0xab, 0x02, 0xc2, 0x01, 0xd6, 0x5b,
284 0xb2, 0x96, 0xa9, 0x04, 0xda, 0xc2, 0x83, 0xb5,
285 0x09, 0x54, 0x69, 0x67, 0xd2, 0x3a, 0x13, 0x6a,
286 0x6c, 0xce, 0xc0, 0x64, 0x92, 0xb5, 0xda, 0x48,
287 0x1c, 0x07, 0x15, 0xfb, 0xdd, 0x5f, 0xb6, 0x66,
288 0x4c, 0x89, 0x44, 0xa0, 0x5c, 0x22, 0x41, 0x3d,
289 0x5f, 0x21, 0x97, 0xa9, 0x0f, 0x58, 0xe9, 0xf8,
290 0x16, 0x5e, 0xd9, 0x1e, 0x9d, 0x99, 0x0a, 0x9c,
291 0xf3, 0x8b, 0x35, 0x3d, 0x0e, 0xc1, 0x10, 0x13,
292 0x77, 0xcf, 0x4d, 0x4c, 0x85, 0xb4, 0x66, 0x27,
293 0xa8, 0x79, 0x8f, 0xa4, 0x9f, 0x5f, 0x1f, 0xe9,
294 0xe6, 0x39, 0xc0, 0xcf, 0x3d, 0x4a, 0x17, 0x3f,
295 0x0b, 0xbf, 0x35, 0xe7, 0xe4, 0x47, 0x66, 0x4d,
296 0x1e, 0xbc, 0x58, 0xf5, 0x62, 0xf8, 0x31, 0x02,
297 0x84, 0xfb, 0x52, 0x39, 0x26, 0x92, 0xc3, 0xff,
298 0x2a, 0x0a, 0x8e, 0x76, 0x66, 0xbc, 0x94, 0x38,
299 0xe2, 0x28, 0x19, 0xcd, 0x40, 0xde, 0x88, 0xdd,
300 0xfe, 0xf1, 0xdd, 0x62, 0xf4, 0xb5, 0x58, 0xf6,
301 0x30, 0x22, 0xc3, 0x94, 0xed, 0xd2, 0x0a, 0x9a,
302 0x71, 0x14, 0xd4, 0xed, 0x70, 0x94, 0x31, 0x00
303 };
304
305 // X.509 IPACCG2 Test Certificate Valid Class 87 device, cms format
306 const uint8_t gkIPACCG2DevCertClass87 [] =
307 {
308 0x30, 0x82, 0x03, 0x8a, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
309 0x01, 0x07, 0x02, 0xa0, 0x82, 0x03, 0x7b, 0x30, 0x82, 0x03, 0x77, 0x02,
310 0x01, 0x01, 0x31, 0x00, 0x30, 0x0b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
311 0xf7, 0x0d, 0x01, 0x07, 0x01, 0xa0, 0x82, 0x03, 0x5d, 0x30, 0x82, 0x03,
312 0x59, 0x30, 0x82, 0x02, 0x41, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x0f,
313 0x33, 0x33, 0xaa, 0x13, 0x02, 0x07, 0xaa, 0x87, 0xaa, 0x00, 0x01, 0xaa,
314 0x00, 0x00, 0x01, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
315 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x81, 0x83, 0x31, 0x0b, 0x30,
316 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13,
317 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x0a, 0x41, 0x70, 0x70,
318 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x31, 0x26, 0x30, 0x24, 0x06,
319 0x03, 0x55, 0x04, 0x0b, 0x13, 0x1d, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20,
320 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
321 0x6e, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x31,
322 0x37, 0x30, 0x35, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x2e, 0x41, 0x70,
323 0x70, 0x6c, 0x65, 0x20, 0x69, 0x50, 0x6f, 0x64, 0x20, 0x41, 0x63, 0x63,
324 0x65, 0x73, 0x73, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x20, 0x43, 0x65, 0x72,
325 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x41,
326 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x30, 0x1e, 0x17, 0x0d,
327 0x31, 0x33, 0x30, 0x32, 0x30, 0x37, 0x30, 0x31, 0x32, 0x33, 0x31, 0x30,
328 0x5a, 0x17, 0x0d, 0x32, 0x31, 0x30, 0x32, 0x30, 0x37, 0x30, 0x31, 0x32,
329 0x33, 0x31, 0x30, 0x5a, 0x30, 0x70, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03,
330 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06,
331 0x03, 0x55, 0x04, 0x0a, 0x13, 0x0a, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20,
332 0x49, 0x6e, 0x63, 0x2e, 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x04,
333 0x0b, 0x13, 0x16, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x69, 0x50, 0x6f,
334 0x64, 0x20, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x69, 0x65,
335 0x73, 0x31, 0x2b, 0x30, 0x29, 0x06, 0x03, 0x55, 0x04, 0x03, 0x14, 0x22,
336 0x49, 0x50, 0x41, 0x5f, 0x33, 0x33, 0x33, 0x33, 0x41, 0x41, 0x31, 0x33,
337 0x30, 0x32, 0x30, 0x37, 0x41, 0x41, 0x38, 0x37, 0x41, 0x41, 0x30, 0x30,
338 0x30, 0x31, 0x41, 0x41, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x30, 0x81,
339 0x9f, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01,
340 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, 0x81, 0x89, 0x02,
341 0x81, 0x81, 0x00, 0xbc, 0xa8, 0x7b, 0xa8, 0xdb, 0x0c, 0xb8, 0x6e, 0x3a,
342 0x1d, 0x57, 0x8c, 0x3a, 0x8c, 0x91, 0xe7, 0x0e, 0x86, 0xc8, 0xe8, 0xd8,
343 0x41, 0xfe, 0x30, 0xd4, 0x77, 0x8c, 0x81, 0xb8, 0x5e, 0x6c, 0x79, 0x29,
344 0xff, 0x57, 0x50, 0x41, 0x0b, 0x2e, 0x7f, 0x64, 0xa5, 0xc5, 0xc6, 0x2a,
345 0x7e, 0x49, 0xdf, 0x65, 0x19, 0x5d, 0x6d, 0x0e, 0x7c, 0xc4, 0xb8, 0xb3,
346 0x1a, 0x59, 0x00, 0x86, 0xa6, 0xde, 0xc3, 0x98, 0x80, 0x20, 0x0e, 0xf1,
347 0xb3, 0x21, 0x1f, 0x68, 0x33, 0xe4, 0x2c, 0xd3, 0x8b, 0x7a, 0x24, 0x55,
348 0xb5, 0xb3, 0x42, 0xa3, 0x2a, 0x40, 0x7c, 0xe4, 0xda, 0x32, 0xb3, 0x41,
349 0xa0, 0x74, 0xe7, 0xfd, 0x97, 0x0c, 0xbe, 0x6f, 0xe3, 0xfd, 0xb9, 0x14,
350 0x89, 0x50, 0xc5, 0xb3, 0x22, 0xcf, 0x47, 0xc7, 0x2e, 0x3b, 0xe3, 0x80,
351 0x13, 0xac, 0x08, 0xe5, 0x3c, 0xe9, 0xbc, 0x56, 0x5f, 0x3b, 0xb9, 0x02,
352 0x03, 0x01, 0x00, 0x01, 0xa3, 0x60, 0x30, 0x5e, 0x30, 0x0e, 0x06, 0x03,
353 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x03, 0xb8,
354 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x02,
355 0x30, 0x00, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04,
356 0x14, 0x09, 0xa5, 0x78, 0x7d, 0xfe, 0x2b, 0x75, 0x6d, 0x3f, 0xf4, 0x2b,
357 0xa2, 0xa2, 0x96, 0xc8, 0x50, 0x16, 0xf7, 0x8b, 0x9f, 0x30, 0x1f, 0x06,
358 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0xff, 0x4b,
359 0x1a, 0x43, 0x9a, 0xf5, 0x19, 0x96, 0xab, 0x18, 0x00, 0x2b, 0x61, 0xc9,
360 0xee, 0x40, 0x9d, 0x8e, 0xc7, 0x04, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86,
361 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01,
362 0x01, 0x00, 0x6b, 0xbb, 0x91, 0x97, 0xcd, 0x17, 0xc5, 0x1b, 0x10, 0xbf,
363 0x29, 0x2d, 0x69, 0xeb, 0xd0, 0x96, 0x32, 0x4f, 0x89, 0x64, 0x82, 0x96,
364 0x52, 0x59, 0x73, 0x15, 0x6b, 0x5d, 0x01, 0xa7, 0x90, 0x34, 0xd7, 0xc0,
365 0x46, 0xc3, 0xfc, 0x27, 0xf0, 0x68, 0xfe, 0xf8, 0x54, 0x76, 0xf8, 0x61,
366 0xc9, 0x91, 0xf8, 0x7d, 0x96, 0x1f, 0x14, 0x7c, 0x09, 0x27, 0xf9, 0x16,
367 0x34, 0x15, 0x19, 0xa8, 0xb3, 0xd0, 0x0f, 0xf3, 0x16, 0xe1, 0xb0, 0x2e,
368 0x70, 0xfe, 0xee, 0x3a, 0xbc, 0x3d, 0x4e, 0x07, 0x86, 0x89, 0x1c, 0xdb,
369 0xe3, 0x2e, 0xc8, 0x66, 0x6a, 0x10, 0x82, 0x13, 0x8f, 0xf0, 0x75, 0xfa,
370 0x6a, 0x25, 0x9d, 0xdb, 0x83, 0x66, 0xb1, 0xae, 0x72, 0x25, 0x03, 0x01,
371 0x2b, 0x74, 0x8b, 0xbb, 0x37, 0xee, 0x92, 0x17, 0x81, 0xb3, 0x9a, 0xd3,
372 0x7b, 0xfc, 0x0c, 0x35, 0xe8, 0xd5, 0x2c, 0xdb, 0x3e, 0x83, 0x9d, 0x05,
373 0x3e, 0x40, 0x18, 0xb0, 0xe6, 0xcf, 0x18, 0x2d, 0x85, 0x96, 0x3f, 0x80,
374 0xcd, 0xff, 0xb5, 0x71, 0xcf, 0xb2, 0x54, 0xab, 0xd3, 0xea, 0x24, 0x86,
375 0xd0, 0xb8, 0xc6, 0x84, 0x75, 0xfa, 0x5e, 0xbf, 0xee, 0x3a, 0xde, 0x2b,
376 0xdf, 0x05, 0x19, 0xf4, 0x1c, 0x02, 0x2f, 0x7f, 0x46, 0xbd, 0x58, 0x0f,
377 0x8a, 0xb6, 0xdf, 0x84, 0xe5, 0xa3, 0x3d, 0x22, 0xf4, 0xff, 0x4a, 0x1a,
378 0x87, 0x1c, 0xa9, 0x0f, 0x73, 0x62, 0x96, 0x96, 0x27, 0x5a, 0x1d, 0x4e,
379 0xfa, 0x1f, 0xa5, 0xf4, 0x08, 0xbf, 0x09, 0x66, 0xde, 0xee, 0x8c, 0xd1,
380 0x57, 0xaf, 0x13, 0xf2, 0x51, 0x93, 0x0b, 0xa9, 0x39, 0x94, 0x71, 0xbc,
381 0x05, 0xa7, 0xa0, 0xda, 0xfa, 0x65, 0x7d, 0x23, 0xa8, 0xb2, 0xa0, 0x89,
382 0x86, 0x1f, 0xd2, 0x57, 0xd8, 0x1b, 0x22, 0x69, 0x8b, 0x48, 0x94, 0x5a,
383 0x5b, 0xaf, 0x92, 0xd9, 0xb6, 0x77, 0xa1, 0x00, 0x31, 0x00
384 }; // gkIPACCG2DevCertClass87 []
385
386 // Concatenated blob of 2 DER certificat
387 const uint8_t TestDoubleCerts1 [] =
388 {
389 0x30, 0x82, 0x01, 0xbe, 0x30, 0x82, 0x01, 0x27, 0x02, 0x01, 0x01, 0x30,
390 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05,
391 0x05, 0x00, 0x30, 0x25, 0x31, 0x23, 0x30, 0x21, 0x06, 0x03, 0x55, 0x04,
392 0x03, 0x13, 0x1a, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x54,
393 0x65, 0x73, 0x74, 0x20, 0x43, 0x41, 0x20, 0x43, 0x65, 0x72, 0x74, 0x20,
394 0x28, 0x52, 0x53, 0x41, 0x29, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x34, 0x30,
395 0x32, 0x32, 0x30, 0x30, 0x30, 0x34, 0x36, 0x33, 0x36, 0x5a, 0x17, 0x0d,
396 0x31, 0x34, 0x30, 0x33, 0x32, 0x32, 0x30, 0x30, 0x34, 0x36, 0x33, 0x36,
397 0x5a, 0x30, 0x2a, 0x31, 0x28, 0x30, 0x26, 0x06, 0x03, 0x55, 0x04, 0x03,
398 0x13, 0x1f, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x54, 0x65,
399 0x73, 0x74, 0x73, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x43,
400 0x65, 0x72, 0x74, 0x20, 0x28, 0x52, 0x53, 0x41, 0x29, 0x30, 0x81, 0x9f,
401 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
402 0x01, 0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81,
403 0x81, 0x00, 0xc8, 0x22, 0x8a, 0x23, 0x42, 0x66, 0x0d, 0x48, 0x64, 0x30,
404 0xf2, 0xe9, 0xa2, 0x2f, 0xdf, 0x55, 0x5b, 0xb9, 0xb8, 0xe4, 0xe7, 0xb3,
405 0xfb, 0x10, 0x63, 0x38, 0x7f, 0x57, 0x55, 0x6a, 0xe8, 0x08, 0xb9, 0x8b,
406 0x70, 0x80, 0x15, 0x3b, 0x4e, 0xdb, 0x0c, 0xa3, 0xc5, 0x0b, 0xdf, 0x28,
407 0xd3, 0x9a, 0x39, 0xb6, 0xca, 0x1d, 0x7b, 0x5f, 0x7b, 0x0c, 0x58, 0x87,
408 0x3d, 0x81, 0xc7, 0xfd, 0x54, 0x3c, 0x0a, 0x60, 0xa2, 0x16, 0xf3, 0x35,
409 0x29, 0x62, 0x40, 0xb2, 0x17, 0x09, 0x5a, 0x9a, 0x81, 0xa7, 0xb3, 0x4f,
410 0x8d, 0x73, 0x3d, 0xe6, 0xbc, 0x53, 0x25, 0x2c, 0x43, 0x07, 0x4b, 0xda,
411 0x0d, 0x73, 0x1b, 0x84, 0x32, 0x85, 0x9e, 0x60, 0xfe, 0xe0, 0xdb, 0x1c,
412 0xf2, 0x4a, 0xed, 0x1b, 0xe9, 0xbc, 0xbc, 0xdd, 0x38, 0xe9, 0x62, 0x16,
413 0xcb, 0x74, 0x2a, 0xa8, 0xe8, 0xbb, 0x74, 0x19, 0x56, 0xfd, 0x02, 0x03,
414 0x01, 0x00, 0x01, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
415 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x4a, 0xde,
416 0xd1, 0x1d, 0xc6, 0xaf, 0xc4, 0xe0, 0x12, 0x0b, 0xb8, 0xd7, 0xc8, 0xaf,
417 0xe9, 0x90, 0x6f, 0x53, 0x15, 0xaa, 0xd1, 0xd5, 0x54, 0x4f, 0x62, 0xb8,
418 0xc7, 0xfc, 0x68, 0x97, 0x3c, 0xdb, 0xca, 0x75, 0x4f, 0xb8, 0x52, 0xe7,
419 0x77, 0xe2, 0x18, 0x78, 0x11, 0x74, 0xd7, 0x2e, 0xf5, 0xc6, 0xc8, 0x00,
420 0x1d, 0xa1, 0x9c, 0xdd, 0xc7, 0x01, 0xb1, 0x34, 0x7a, 0x48, 0x8a, 0x2c,
421 0x34, 0x7e, 0x43, 0x56, 0x50, 0xc2, 0xf1, 0x7c, 0x02, 0x5e, 0xd7, 0x16,
422 0xae, 0xea, 0x31, 0x70, 0x54, 0xd9, 0xad, 0x15, 0xcd, 0xc7, 0x07, 0x99,
423 0x30, 0x0a, 0xff, 0xdb, 0x7a, 0x72, 0xf6, 0x89, 0x51, 0x01, 0x81, 0x3b,
424 0x97, 0x46, 0x99, 0x8a, 0x52, 0x42, 0xaf, 0x63, 0xa2, 0x1d, 0xc0, 0xae,
425 0x09, 0xa6, 0x6c, 0x7c, 0x7f, 0x93, 0xc7, 0xd0, 0x18, 0x97, 0x6b, 0x59,
426 0xa9, 0x23, 0x84, 0x65, 0xf9, 0xfd,
427 };
428
429 const uint8_t TestDoubleCerts2 [] =
430 {
431 0x30, 0x82, 0x01, 0xbf, 0x30, 0x82,
432 0x01, 0x28, 0x02, 0x02, 0x03, 0xe9, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86,
433 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x25, 0x31,
434 0x23, 0x30, 0x21, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1a, 0x53, 0x65,
435 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43,
436 0x41, 0x20, 0x43, 0x65, 0x72, 0x74, 0x20, 0x28, 0x52, 0x53, 0x41, 0x29,
437 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x34, 0x30, 0x32, 0x32, 0x31, 0x31, 0x37,
438 0x34, 0x38, 0x32, 0x39, 0x5a, 0x17, 0x0d, 0x31, 0x34, 0x30, 0x33, 0x32,
439 0x33, 0x31, 0x37, 0x34, 0x38, 0x32, 0x39, 0x5a, 0x30, 0x2a, 0x31, 0x28,
440 0x30, 0x26, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1f, 0x53, 0x65, 0x63,
441 0x75, 0x72, 0x69, 0x74, 0x79, 0x54, 0x65, 0x73, 0x74, 0x73, 0x20, 0x43,
442 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x43, 0x65, 0x72, 0x74, 0x20, 0x28,
443 0x52, 0x53, 0x41, 0x29, 0x30, 0x81, 0x9f, 0x30, 0x0d, 0x06, 0x09, 0x2a,
444 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81,
445 0x8d, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xd0, 0x4a, 0x1a,
446 0x4d, 0xd7, 0x53, 0x22, 0xcf, 0xd3, 0xf3, 0x40, 0x9e, 0x14, 0xb5, 0x60,
447 0xca, 0xcf, 0x2b, 0xd6, 0x48, 0x82, 0x6c, 0x15, 0x8f, 0xd8, 0xfb, 0xd1,
448 0x38, 0x9a, 0x80, 0x3a, 0xcf, 0x03, 0xc6, 0xcd, 0x30, 0xc3, 0xe2, 0xa6,
449 0x95, 0x23, 0x4f, 0xba, 0x1a, 0x6d, 0x78, 0x25, 0xd5, 0x63, 0x21, 0xe3,
450 0x0f, 0x82, 0xfc, 0xcd, 0x84, 0xb0, 0xf5, 0xd2, 0xa6, 0x8c, 0x61, 0x26,
451 0x7c, 0x50, 0x1a, 0x8b, 0xb0, 0x2c, 0x14, 0xaf, 0xf9, 0xb1, 0xb8, 0x96,
452 0x72, 0x37, 0x67, 0x50, 0x57, 0x5b, 0x9f, 0xa2, 0x68, 0x04, 0x9b, 0x53,
453 0x42, 0x1f, 0x24, 0xc3, 0x5d, 0x57, 0x66, 0x48, 0x2b, 0xe7, 0xd5, 0xf4,
454 0x33, 0x84, 0xb3, 0x4a, 0x71, 0x6d, 0x69, 0xc1, 0xc4, 0x97, 0x22, 0x20,
455 0xf6, 0x4e, 0x83, 0xda, 0x69, 0x6e, 0x07, 0x3c, 0x8b, 0xa3, 0xe4, 0x38,
456 0x89, 0x64, 0x41, 0x25, 0x49, 0x02, 0x03, 0x01, 0x00, 0x01, 0x30, 0x0d,
457 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05,
458 0x00, 0x03, 0x81, 0x81, 0x00, 0x9c, 0x2d, 0xe5, 0x32, 0x6b, 0x41, 0xaf,
459 0x37, 0x30, 0x61, 0xd8, 0xf5, 0x0e, 0x7b, 0x3b, 0x57, 0x42, 0x08, 0x5c,
460 0x28, 0x42, 0x7c, 0x1f, 0x40, 0xe9, 0xfc, 0xd4, 0x4b, 0x5c, 0x56, 0x83,
461 0xb2, 0x85, 0x67, 0x11, 0x6c, 0x7a, 0x16, 0x16, 0x3f, 0xd6, 0xe0, 0xe9,
462 0x89, 0xa5, 0xd9, 0xdc, 0x91, 0x34, 0xb9, 0x83, 0x71, 0xee, 0x69, 0xe1,
463 0x7b, 0x4a, 0x4f, 0x1c, 0x1e, 0x7f, 0x74, 0x7c, 0xb6, 0x1c, 0xf3, 0xca,
464 0xf8, 0xe7, 0x67, 0xbc, 0x73, 0xfc, 0xfa, 0x5e, 0x98, 0x52, 0xe3, 0x43,
465 0x77, 0x32, 0xad, 0xcf, 0x81, 0x6f, 0xf4, 0xba, 0x61, 0x37, 0xff, 0xa7,
466 0xf3, 0xfe, 0xf6, 0x67, 0x44, 0x41, 0x2e, 0x56, 0x91, 0x25, 0x8c, 0xc3,
467 0xea, 0x9c, 0x85, 0xc9, 0x32, 0xde, 0xa9, 0x62, 0xcb, 0x3c, 0xb7, 0xbd,
468 0x8d, 0x16, 0xec, 0xcf, 0x52, 0x17, 0xc8, 0x47, 0x99, 0x94, 0xe1, 0x4c,
469 0x39
470 };
471
472
473 /* Basic processing of input */
474 static void tests(void)
475 {
476 CFArrayRef certs = NULL;
477 CFDataRef message;
478 CFIndex count;
479
480 // Premade message containing one certificate blob
481 message = CFDataCreateWithBytesNoCopy(kCFAllocatorDefault,
482 certsOnlyMsg, sizeof(certsOnlyMsg), kCFAllocatorNull);
483 ok(certs = SecCMSCertificatesOnlyMessageCopyCertificates(message),
484 "SecCMSCertificatesOnlyMessageCopyCertificates");
485 is(CFArrayGetCount(certs), 1, "certificate count is 1");
486 CFReleaseNull(message);
487 CFReleaseNull(certs);
488
489 // Premade message containing one certificate blob
490 message = CFDataCreateWithBytesNoCopy(kCFAllocatorDefault,
491 gkIPACCG2DevCertClass87, sizeof(gkIPACCG2DevCertClass87), kCFAllocatorNull);
492 ok(certs = SecCMSCertificatesOnlyMessageCopyCertificates(message),
493 "SecCMSCertificatesOnlyMessageCopyCertificates");
494 is(CFArrayGetCount(certs), 1, "certificate count is 1");
495 CFReleaseNull(message);
496 CFReleaseNull(certs);
497
498 SecCertificateRef another_cert = NULL;
499 CFMutableArrayRef input_certs = NULL;
500
501 // Process a single raw certificate and make it a message
502 isnt(another_cert = SecCertificateCreateWithBytes(NULL, _c1, sizeof(_c1)),
503 NULL, "create certificate");
504 ok(message = SecCMSCreateCertificatesOnlyMessageIAP(another_cert), "create iAP specific cert only message (1cert)");
505 ok(certs = SecCMSCertificatesOnlyMessageCopyCertificates(message),
506 "SecCMSCertificatesOnlyMessageCopyCertificates");
507 is(CFArrayGetCount(certs), 1, "certificate count is 1");
508 CFReleaseNull(certs);
509 CFReleaseNull(message);
510 CFReleaseNull(another_cert);
511
512 // Process two raw certificates and make it a message
513 input_certs = CFArrayCreateMutable(NULL, 3, &kCFTypeArrayCallBacks);
514 isnt(another_cert = SecCertificateCreateWithBytes(NULL, TestDoubleCerts1, sizeof(TestDoubleCerts1)),
515 NULL, "create certificate");
516 CFArrayAppendValue(input_certs, another_cert);
517 CFReleaseNull(another_cert);
518 isnt(another_cert = SecCertificateCreateWithBytes(NULL, TestDoubleCerts2, sizeof(TestDoubleCerts2)),
519 NULL, "create certificate");
520 CFArrayAppendValue(input_certs, another_cert);
521 CFReleaseNull(another_cert);
522
523 ok(message = SecCMSCreateCertificatesOnlyMessage(input_certs), "create cert only message (2certs)");
524 ok(certs = SecCMSCertificatesOnlyMessageCopyCertificates(message),
525 "SecCMSCertificatesOnlyMessageCopyCertificates");
526 count = (certs) ? CFArrayGetCount(certs) : 0;
527 ok(count == 2, "certificate count is 2");
528
529 // Clean up
530 CFReleaseNull(another_cert);
531 CFReleaseNull(message);
532 CFReleaseNull(input_certs);
533 CFReleaseNull(certs);
534 }
535
536
537 int smime_cms_test(int argc, char *const *argv)
538 {
539 plan_tests(13);
540
541 tests();
542
543 return 0;
544 }