]> git.saurik.com Git - apple/security.git/blob - OSX/sec/Security/Regressions/secitem/si-81-sectrust-appletv.c
Security-57337.40.85.tar.gz
[apple/security.git] / OSX / sec / Security / Regressions / secitem / si-81-sectrust-appletv.c
1 /*
2 * si-81-sectrust-appletv.c
3 * Security
4 *
5 * Copyright (c) 2015 Apple Inc. All Rights Reserved.
6 *
7 */
8
9 #include <CoreFoundation/CoreFoundation.h>
10 #include <Security/SecCertificate.h>
11 #include <Security/SecCertificatePriv.h>
12 #include <Security/SecCertificateInternal.h>
13 #include <Security/SecItem.h>
14 #include <Security/SecItemPriv.h>
15 #include <Security/SecIdentityPriv.h>
16 #include <Security/SecIdentity.h>
17 #include <Security/SecPolicy.h>
18 #include <Security/SecPolicyPriv.h>
19 #include <Security/SecPolicyInternal.h>
20 #include <Security/SecCMS.h>
21 #include <utilities/SecCFWrappers.h>
22 #include <stdlib.h>
23 #include <unistd.h>
24
25 #include "Security_regressions.h"
26
27 static const UInt8 kTestAppleTVOSAppSigLeaf[] = {
28 0x30, 0x82, 0x05, 0x5f, 0x30, 0x82, 0x04, 0x47, 0xa0, 0x03, 0x02, 0x01,
29 0x02, 0x02, 0x08, 0x34, 0xc4, 0xe1, 0x74, 0xfd, 0x82, 0xed, 0x21, 0x30,
30 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b,
31 0x05, 0x00, 0x30, 0x81, 0x96, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,
32 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03,
33 0x55, 0x04, 0x0a, 0x0c, 0x0a, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x49,
34 0x6e, 0x63, 0x2e, 0x31, 0x2c, 0x30, 0x2a, 0x06, 0x03, 0x55, 0x04, 0x0b,
35 0x0c, 0x23, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x57, 0x6f, 0x72, 0x6c,
36 0x64, 0x77, 0x69, 0x64, 0x65, 0x20, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f,
37 0x70, 0x65, 0x72, 0x20, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
38 0x73, 0x31, 0x44, 0x30, 0x42, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x3b,
39 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x77,
40 0x69, 0x64, 0x65, 0x20, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65,
41 0x72, 0x20, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20,
42 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
43 0x6e, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x30,
44 0x1e, 0x17, 0x0d, 0x31, 0x35, 0x30, 0x36, 0x32, 0x36, 0x32, 0x32, 0x34,
45 0x30, 0x31, 0x37, 0x5a, 0x17, 0x0d, 0x32, 0x33, 0x30, 0x32, 0x30, 0x37,
46 0x32, 0x31, 0x34, 0x38, 0x34, 0x37, 0x5a, 0x30, 0x4b, 0x31, 0x27, 0x30,
47 0x25, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x1e, 0x41, 0x70, 0x70, 0x6c,
48 0x65, 0x20, 0x54, 0x56, 0x4f, 0x53, 0x20, 0x41, 0x70, 0x70, 0x6c, 0x69,
49 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x53, 0x69, 0x67, 0x6e, 0x69,
50 0x6e, 0x67, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c,
51 0x0a, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x31,
52 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53,
53 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
54 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00,
55 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xba, 0x8f, 0xd0,
56 0x2b, 0xfb, 0x04, 0x41, 0x7e, 0xef, 0x73, 0xf1, 0x86, 0x5b, 0xce, 0xe8,
57 0x0d, 0xb5, 0xec, 0x5f, 0xd9, 0x24, 0x49, 0x6d, 0x5c, 0x97, 0xeb, 0xb2,
58 0xa6, 0xfb, 0x7c, 0x9f, 0xcf, 0xd0, 0x18, 0xfa, 0xa1, 0xdf, 0x9f, 0x4a,
59 0x42, 0xc3, 0xc3, 0xd3, 0x46, 0x91, 0x8c, 0x74, 0x3b, 0x6e, 0x54, 0xb8,
60 0xe7, 0xec, 0x10, 0x8b, 0xc0, 0x2f, 0xe8, 0x96, 0x86, 0xaa, 0x8b, 0xb7,
61 0x8f, 0xee, 0x2a, 0x31, 0xf3, 0xaf, 0x04, 0x77, 0x16, 0x09, 0x9e, 0xf9,
62 0x9d, 0x30, 0x74, 0x5d, 0x9e, 0xb1, 0x11, 0x66, 0xef, 0x0d, 0x61, 0x1c,
63 0xc2, 0xfe, 0x6b, 0x75, 0x80, 0x0e, 0x42, 0x14, 0x4e, 0xdc, 0x38, 0xfd,
64 0x18, 0x22, 0x03, 0xe0, 0x51, 0xbd, 0xd0, 0xf3, 0x52, 0x36, 0xff, 0x83,
65 0x90, 0xde, 0xbe, 0x60, 0xec, 0x82, 0x66, 0xad, 0x49, 0x54, 0x71, 0x39,
66 0xdd, 0x48, 0xc3, 0x13, 0x99, 0xc2, 0xcc, 0x77, 0x55, 0x5e, 0x48, 0xeb,
67 0xee, 0x34, 0x31, 0x04, 0xef, 0x7e, 0xe1, 0x42, 0x54, 0x10, 0xcf, 0x09,
68 0x9c, 0x0d, 0xc4, 0x55, 0x3d, 0x30, 0x98, 0x78, 0xfb, 0x38, 0xac, 0xdb,
69 0xd8, 0x63, 0x3f, 0x64, 0x07, 0x7f, 0x53, 0x4d, 0xc8, 0xbc, 0x60, 0x3e,
70 0x89, 0x49, 0x88, 0x07, 0xb4, 0x80, 0x15, 0xd5, 0xc2, 0x13, 0x8b, 0xff,
71 0x0c, 0x90, 0xb6, 0x67, 0x0c, 0xaf, 0xf4, 0xef, 0x5c, 0x9d, 0xba, 0xf3,
72 0x95, 0x5b, 0xd2, 0x9a, 0x7e, 0x80, 0x8d, 0xc9, 0x6f, 0xcd, 0x75, 0xe5,
73 0xb6, 0xfb, 0x61, 0x8b, 0x9c, 0x3b, 0xce, 0xc2, 0x4c, 0xba, 0xb7, 0xf6,
74 0x48, 0xa6, 0x79, 0x4a, 0x34, 0xf1, 0xe1, 0x47, 0xba, 0x29, 0x5d, 0x04,
75 0x26, 0x64, 0xee, 0x5e, 0x8e, 0x0c, 0x9d, 0xa7, 0x05, 0xe3, 0x58, 0xd7,
76 0xe4, 0xb5, 0x4e, 0x7b, 0xdc, 0x2a, 0xab, 0xc1, 0xea, 0x82, 0x7d, 0xcb,
77 0x93, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x82, 0x01, 0xf9, 0x30, 0x82,
78 0x01, 0xf5, 0x30, 0x47, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07,
79 0x01, 0x01, 0x04, 0x3b, 0x30, 0x39, 0x30, 0x37, 0x06, 0x08, 0x2b, 0x06,
80 0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x86, 0x2b, 0x68, 0x74, 0x74, 0x70,
81 0x3a, 0x2f, 0x2f, 0x6f, 0x63, 0x73, 0x70, 0x2e, 0x61, 0x70, 0x70, 0x6c,
82 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x63, 0x73, 0x70, 0x30, 0x34,
83 0x2d, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x77, 0x77, 0x64, 0x72, 0x63, 0x61,
84 0x32, 0x30, 0x33, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16,
85 0x04, 0x14, 0x49, 0xaa, 0xae, 0x84, 0x57, 0x14, 0x56, 0x8f, 0x0b, 0xeb,
86 0x63, 0x6b, 0x62, 0x75, 0x68, 0xfc, 0x5b, 0x8c, 0x77, 0xa1, 0x30, 0x0c,
87 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00,
88 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80,
89 0x14, 0x88, 0x27, 0x17, 0x09, 0xa9, 0xb6, 0x18, 0x60, 0x8b, 0xec, 0xeb,
90 0xba, 0xf6, 0x47, 0x59, 0xc5, 0x52, 0x54, 0xa3, 0xb7, 0x30, 0x82, 0x01,
91 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x20, 0x04, 0x82, 0x01, 0x14, 0x30, 0x82,
92 0x01, 0x10, 0x30, 0x82, 0x01, 0x0c, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
93 0xf7, 0x63, 0x64, 0x05, 0x01, 0x30, 0x81, 0xfe, 0x30, 0x81, 0xc3, 0x06,
94 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x02, 0x02, 0x30, 0x81, 0xb6,
95 0x0c, 0x81, 0xb3, 0x52, 0x65, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x20,
96 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x63, 0x65, 0x72, 0x74,
97 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x62, 0x79, 0x20, 0x61,
98 0x6e, 0x79, 0x20, 0x70, 0x61, 0x72, 0x74, 0x79, 0x20, 0x61, 0x73, 0x73,
99 0x75, 0x6d, 0x65, 0x73, 0x20, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x61,
100 0x6e, 0x63, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74,
101 0x68, 0x65, 0x6e, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x62,
102 0x6c, 0x65, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x20,
103 0x74, 0x65, 0x72, 0x6d, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x63, 0x6f,
104 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20,
105 0x75, 0x73, 0x65, 0x2c, 0x20, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69,
106 0x63, 0x61, 0x74, 0x65, 0x20, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x20,
107 0x61, 0x6e, 0x64, 0x20, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63,
108 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x70, 0x72, 0x61, 0x63, 0x74, 0x69,
109 0x63, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74,
110 0x73, 0x2e, 0x30, 0x36, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07,
111 0x02, 0x01, 0x16, 0x2a, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77,
112 0x77, 0x77, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d,
113 0x2f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65,
114 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x2f, 0x30, 0x0e,
115 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02,
116 0x07, 0x80, 0x30, 0x16, 0x06, 0x03, 0x55, 0x1d, 0x25, 0x01, 0x01, 0xff,
117 0x04, 0x0c, 0x30, 0x0a, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07,
118 0x03, 0x03, 0x30, 0x13, 0x06, 0x0a, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x63,
119 0x64, 0x06, 0x01, 0x18, 0x01, 0x01, 0xff, 0x04, 0x02, 0x05, 0x00, 0x30,
120 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b,
121 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x9c, 0x07, 0xde, 0xde, 0xc2,
122 0xfc, 0x6c, 0x94, 0xb1, 0x1a, 0x6a, 0x38, 0x75, 0xe0, 0x74, 0x70, 0xe9,
123 0x9d, 0x47, 0xd6, 0xde, 0xcd, 0xd0, 0xdb, 0xed, 0x2f, 0x50, 0xfa, 0x0d,
124 0xe3, 0xb9, 0x3d, 0x36, 0xc9, 0x4b, 0xee, 0x4e, 0xc4, 0x83, 0xb9, 0x7d,
125 0x40, 0x01, 0x92, 0x3f, 0x18, 0x8a, 0x19, 0xe8, 0xac, 0x5d, 0xb1, 0xc1,
126 0xd2, 0x30, 0x98, 0x85, 0x28, 0x91, 0x0c, 0x92, 0x71, 0x79, 0xec, 0x4b,
127 0x51, 0xcc, 0xdf, 0x99, 0x71, 0x87, 0x04, 0x60, 0x09, 0x3e, 0xfa, 0x56,
128 0x9f, 0x99, 0xa3, 0xef, 0x0c, 0x02, 0xd2, 0xdf, 0xcf, 0x18, 0xf2, 0x34,
129 0x6e, 0x93, 0xd0, 0x0e, 0x81, 0xe4, 0x4e, 0x37, 0x7b, 0x1d, 0xe7, 0x8c,
130 0xa6, 0x71, 0x6d, 0x95, 0x66, 0x7d, 0xc0, 0x80, 0x74, 0x71, 0xe1, 0xd7,
131 0x97, 0x35, 0x9b, 0x26, 0xe9, 0x84, 0x4a, 0x96, 0x30, 0xfc, 0xf1, 0x26,
132 0x23, 0x1d, 0xec, 0x71, 0x2f, 0x39, 0x40, 0x14, 0xaf, 0x34, 0x0e, 0x85,
133 0x3c, 0xd0, 0x9e, 0x8d, 0x4e, 0xf8, 0x04, 0x0a, 0xc2, 0x3f, 0x44, 0x7d,
134 0x19, 0x2d, 0xe7, 0xc0, 0xf1, 0xce, 0xa9, 0x2f, 0x6c, 0x79, 0xbd, 0x65,
135 0x69, 0x3e, 0xf6, 0x76, 0x59, 0xeb, 0x70, 0x0c, 0xaf, 0x04, 0x44, 0x82,
136 0x02, 0x15, 0x24, 0x3e, 0xc3, 0xe0, 0x9e, 0x5d, 0xa0, 0xe3, 0x66, 0x72,
137 0x59, 0x6e, 0x51, 0x41, 0xd6, 0x72, 0xdd, 0x4d, 0xca, 0x96, 0xb0, 0x1a,
138 0xc1, 0x47, 0x5a, 0xef, 0xc9, 0xc4, 0x11, 0x11, 0x7a, 0xec, 0x9c, 0x1c,
139 0x12, 0x19, 0x72, 0xb8, 0xc3, 0x98, 0x3e, 0x3b, 0xe7, 0x4a, 0x3f, 0xb8,
140 0x48, 0x40, 0xd6, 0x68, 0xa9, 0xce, 0x07, 0xe7, 0x0e, 0x5e, 0x56, 0x33,
141 0xf8, 0xb0, 0x4c, 0xc2, 0xb6, 0x25, 0xcc, 0x5f, 0xbd, 0xdb, 0xe5, 0x78,
142 0xb6, 0x5f, 0x99, 0x3e, 0xdc, 0xaf, 0x20, 0x3d, 0x5a, 0x0f, 0x13
143 };
144
145 static const UInt8 kTestAppleTVOSAppSigTestLeaf[] = {
146 0x30, 0x82, 0x05, 0x52, 0x30, 0x82, 0x04, 0x3a, 0xa0, 0x03, 0x02, 0x01,
147 0x02, 0x02, 0x08, 0x29, 0x7b, 0x51, 0x36, 0x47, 0xa4, 0x6f, 0x23, 0x30,
148 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b,
149 0x05, 0x00, 0x30, 0x81, 0x96, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,
150 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03,
151 0x55, 0x04, 0x0a, 0x0c, 0x0a, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x49,
152 0x6e, 0x63, 0x2e, 0x31, 0x2c, 0x30, 0x2a, 0x06, 0x03, 0x55, 0x04, 0x0b,
153 0x0c, 0x23, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x57, 0x6f, 0x72, 0x6c,
154 0x64, 0x77, 0x69, 0x64, 0x65, 0x20, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f,
155 0x70, 0x65, 0x72, 0x20, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
156 0x73, 0x31, 0x44, 0x30, 0x42, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x3b,
157 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x77,
158 0x69, 0x64, 0x65, 0x20, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65,
159 0x72, 0x20, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20,
160 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
161 0x6e, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x30,
162 0x1e, 0x17, 0x0d, 0x31, 0x35, 0x30, 0x32, 0x30, 0x36, 0x32, 0x33, 0x35,
163 0x33, 0x31, 0x36, 0x5a, 0x17, 0x0d, 0x32, 0x33, 0x30, 0x32, 0x30, 0x37,
164 0x32, 0x31, 0x34, 0x38, 0x34, 0x37, 0x5a, 0x30, 0x55, 0x31, 0x31, 0x30,
165 0x2f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x28, 0x54, 0x45, 0x53, 0x54,
166 0x20, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x54, 0x56, 0x4f, 0x53, 0x20,
167 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20,
168 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x54, 0x45, 0x53, 0x54,
169 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x0a, 0x41,
170 0x70, 0x70, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x31, 0x0b, 0x30,
171 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x30, 0x82,
172 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
173 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82,
174 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xc9, 0x74, 0x71, 0x4a, 0x58,
175 0x65, 0xdf, 0x19, 0x27, 0x08, 0x97, 0x9b, 0xf3, 0x12, 0x14, 0x8e, 0xa2,
176 0xd0, 0xa2, 0x1e, 0x1d, 0x46, 0xae, 0xdf, 0xc4, 0xef, 0x57, 0xc0, 0x82,
177 0x5f, 0xb9, 0xe5, 0x63, 0x53, 0x57, 0xad, 0xaa, 0x32, 0x84, 0x6f, 0xbe,
178 0xdf, 0x65, 0x1f, 0x73, 0x0a, 0x85, 0x55, 0x3a, 0xb3, 0xcf, 0x43, 0x02,
179 0x18, 0xe4, 0xad, 0x04, 0xa0, 0x83, 0x89, 0x3d, 0x6f, 0xfa, 0xdf, 0xb3,
180 0x82, 0xa2, 0xb2, 0x6d, 0x46, 0x63, 0x4d, 0x88, 0x0a, 0xe7, 0x96, 0x68,
181 0x3b, 0x6f, 0x96, 0xf8, 0xa9, 0x92, 0x18, 0x15, 0x0d, 0xf4, 0xe9, 0x44,
182 0xf5, 0x62, 0xf1, 0x50, 0x4d, 0x86, 0x60, 0x5b, 0x89, 0x72, 0x3c, 0x53,
183 0x8a, 0xda, 0x3a, 0x4f, 0x1d, 0x58, 0x1a, 0xc2, 0xaf, 0x46, 0x0c, 0x6d,
184 0x53, 0x6d, 0xa3, 0x4d, 0x36, 0xa0, 0xfe, 0x54, 0xc6, 0xdd, 0x94, 0x01,
185 0x43, 0xc1, 0xdf, 0x62, 0xd2, 0x2e, 0x76, 0x96, 0x10, 0x29, 0x30, 0x4f,
186 0x51, 0x35, 0x5d, 0x5f, 0x10, 0x32, 0x0f, 0xec, 0xad, 0xd0, 0x0a, 0xc1,
187 0xde, 0x7f, 0x7d, 0xcc, 0xa7, 0x4b, 0x67, 0x5e, 0x97, 0xbf, 0x45, 0x9f,
188 0x0b, 0x68, 0x93, 0x0b, 0x42, 0x7b, 0x49, 0xf9, 0xda, 0x3d, 0xa3, 0x5e,
189 0x22, 0x6b, 0x48, 0x2d, 0x86, 0x96, 0x25, 0xc1, 0x78, 0x11, 0xad, 0x7f,
190 0x70, 0x43, 0x49, 0x05, 0x8d, 0x59, 0xe2, 0x80, 0x51, 0x79, 0x58, 0x5c,
191 0xfb, 0x75, 0x6c, 0xa0, 0x7f, 0x62, 0xf5, 0x7d, 0xc1, 0xe7, 0xf8, 0x06,
192 0x85, 0x9f, 0xb3, 0xaa, 0x90, 0x98, 0x53, 0x8d, 0x7b, 0x40, 0x04, 0x71,
193 0xf4, 0xa4, 0xce, 0xa0, 0x20, 0x3d, 0x77, 0x32, 0xf5, 0x94, 0x20, 0x54,
194 0xa2, 0xe2, 0x98, 0x8c, 0x38, 0x63, 0x94, 0xe5, 0x73, 0xa1, 0xcc, 0xcc,
195 0xe4, 0x11, 0x34, 0xfb, 0xff, 0x41, 0x63, 0x2c, 0x39, 0xaf, 0x39, 0x02,
196 0x03, 0x01, 0x00, 0x01, 0xa3, 0x82, 0x01, 0xe2, 0x30, 0x82, 0x01, 0xde,
197 0x30, 0x47, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x01, 0x01,
198 0x04, 0x3b, 0x30, 0x39, 0x30, 0x37, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05,
199 0x05, 0x07, 0x30, 0x01, 0x86, 0x2b, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,
200 0x2f, 0x6f, 0x63, 0x73, 0x70, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e,
201 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x63, 0x73, 0x70, 0x30, 0x34, 0x2d, 0x61,
202 0x70, 0x70, 0x6c, 0x65, 0x77, 0x77, 0x64, 0x72, 0x63, 0x61, 0x32, 0x30,
203 0x34, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14,
204 0x0a, 0x14, 0xfb, 0x9f, 0x6f, 0x4e, 0x79, 0xc0, 0xbb, 0xc8, 0xa5, 0x35,
205 0xeb, 0x06, 0x6a, 0xe7, 0x45, 0x6a, 0x61, 0xad, 0x30, 0x0c, 0x06, 0x03,
206 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00, 0x30, 0x1f,
207 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x88,
208 0x27, 0x17, 0x09, 0xa9, 0xb6, 0x18, 0x60, 0x8b, 0xec, 0xeb, 0xba, 0xf6,
209 0x47, 0x59, 0xc5, 0x52, 0x54, 0xa3, 0xb7, 0x30, 0x82, 0x01, 0x1d, 0x06,
210 0x03, 0x55, 0x1d, 0x20, 0x04, 0x82, 0x01, 0x14, 0x30, 0x82, 0x01, 0x10,
211 0x30, 0x82, 0x01, 0x0c, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x63,
212 0x64, 0x05, 0x01, 0x30, 0x81, 0xfe, 0x30, 0x81, 0xc3, 0x06, 0x08, 0x2b,
213 0x06, 0x01, 0x05, 0x05, 0x07, 0x02, 0x02, 0x30, 0x81, 0xb6, 0x0c, 0x81,
214 0xb3, 0x52, 0x65, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x20, 0x6f, 0x6e,
215 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66,
216 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x62, 0x79, 0x20, 0x61, 0x6e, 0x79,
217 0x20, 0x70, 0x61, 0x72, 0x74, 0x79, 0x20, 0x61, 0x73, 0x73, 0x75, 0x6d,
218 0x65, 0x73, 0x20, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x61, 0x6e, 0x63,
219 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x68, 0x65,
220 0x6e, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x62, 0x6c, 0x65,
221 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x20, 0x74, 0x65,
222 0x72, 0x6d, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x63, 0x6f, 0x6e, 0x64,
223 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x75, 0x73,
224 0x65, 0x2c, 0x20, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61,
225 0x74, 0x65, 0x20, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x20, 0x61, 0x6e,
226 0x64, 0x20, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
227 0x69, 0x6f, 0x6e, 0x20, 0x70, 0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65,
228 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e,
229 0x30, 0x36, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x02, 0x01,
230 0x16, 0x2a, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77,
231 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63,
232 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x61, 0x75,
233 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x2f, 0x30, 0x0e, 0x06, 0x03,
234 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80,
235 0x30, 0x14, 0x06, 0x0b, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x63, 0x64, 0x06,
236 0x01, 0x18, 0x01, 0x01, 0x01, 0xff, 0x04, 0x02, 0x05, 0x00, 0x30, 0x0d,
237 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05,
238 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x58, 0xef, 0x32, 0x6c, 0x48, 0x29,
239 0xfa, 0x5e, 0x5e, 0x32, 0xa6, 0xbe, 0xe4, 0xd2, 0x3e, 0x72, 0xcf, 0xb9,
240 0x74, 0x62, 0x84, 0x90, 0xa1, 0x5f, 0xbb, 0xd3, 0x3d, 0x67, 0x19, 0xf4,
241 0x1b, 0xa1, 0x31, 0x38, 0xe0, 0xdb, 0xe4, 0x14, 0x6d, 0x9e, 0x99, 0x34,
242 0xd3, 0x53, 0x97, 0xb4, 0xaa, 0x63, 0x61, 0x56, 0xac, 0x1e, 0x70, 0x54,
243 0x98, 0x18, 0x2d, 0xc9, 0xa8, 0x31, 0x21, 0x95, 0x64, 0x25, 0xc1, 0x3e,
244 0xfa, 0xbb, 0xc8, 0x13, 0x9b, 0x0c, 0xa5, 0xa5, 0xc2, 0x8e, 0x4e, 0xad,
245 0x25, 0xef, 0xbe, 0x94, 0xe6, 0x0e, 0x91, 0x36, 0x44, 0xad, 0x93, 0x12,
246 0x20, 0x3c, 0x3a, 0xc0, 0xfe, 0x6d, 0x47, 0xbe, 0xa1, 0x29, 0xde, 0x53,
247 0xee, 0x6c, 0xee, 0x56, 0xec, 0xae, 0xeb, 0x08, 0x24, 0x3e, 0x43, 0xef,
248 0x92, 0x6b, 0x2a, 0x66, 0x5c, 0x9f, 0x25, 0x77, 0x4e, 0x96, 0x45, 0x4d,
249 0xd7, 0xac, 0xc0, 0xc8, 0xfe, 0xd2, 0x37, 0x52, 0xc8, 0xcb, 0xe3, 0x26,
250 0xad, 0xb2, 0xd9, 0x90, 0x3f, 0x68, 0x93, 0xb5, 0x3f, 0x10, 0xd3, 0x61,
251 0xb7, 0x09, 0x35, 0x42, 0xd4, 0xf4, 0xde, 0x3b, 0x42, 0x3e, 0x8c, 0xe1,
252 0xe8, 0xa7, 0xcb, 0x24, 0x2c, 0x38, 0xd1, 0xa0, 0x99, 0x22, 0xd9, 0xab,
253 0x3a, 0x39, 0xda, 0x78, 0x22, 0x2a, 0x01, 0xe2, 0xda, 0x30, 0x0b, 0x82,
254 0xca, 0x7d, 0xe0, 0xca, 0xd0, 0x95, 0x13, 0x50, 0x4f, 0x85, 0x86, 0x83,
255 0x3d, 0x3d, 0xa2, 0x2c, 0xeb, 0x46, 0x7c, 0x50, 0xc0, 0x5a, 0x60, 0x7b,
256 0x70, 0xb5, 0x5f, 0xb7, 0xa8, 0x54, 0x81, 0xe7, 0xb0, 0xf2, 0x91, 0xc6,
257 0xd6, 0xc1, 0xc4, 0xd6, 0xdb, 0xea, 0xfa, 0xf4, 0xf0, 0x6c, 0x00, 0xbf,
258 0x0f, 0x71, 0xff, 0xb3, 0x6c, 0x59, 0x08, 0x2f, 0x28, 0xd3, 0xaf, 0xc3,
259 0xd2, 0xde, 0xe1, 0x1a, 0x54, 0x76, 0xfe, 0x2c, 0x98, 0xf1
260 };
261
262 static const UInt8 kTestAppleWWDRIntm[] = {
263 0x30, 0x82, 0x04, 0x23, 0x30, 0x82, 0x03, 0x0b, 0xa0, 0x03, 0x02, 0x01,
264 0x02, 0x02, 0x01, 0x19, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
265 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x62, 0x31, 0x0b, 0x30,
266 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13,
267 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x0a, 0x41, 0x70, 0x70,
268 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x31, 0x26, 0x30, 0x24, 0x06,
269 0x03, 0x55, 0x04, 0x0b, 0x13, 0x1d, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20,
270 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
271 0x6e, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x31,
272 0x16, 0x30, 0x14, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0d, 0x41, 0x70,
273 0x70, 0x6c, 0x65, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x43, 0x41, 0x30,
274 0x1e, 0x17, 0x0d, 0x30, 0x38, 0x30, 0x32, 0x31, 0x34, 0x31, 0x38, 0x35,
275 0x36, 0x33, 0x35, 0x5a, 0x17, 0x0d, 0x31, 0x36, 0x30, 0x32, 0x31, 0x34,
276 0x31, 0x38, 0x35, 0x36, 0x33, 0x35, 0x5a, 0x30, 0x81, 0x96, 0x31, 0x0b,
277 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31,
278 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x0a, 0x41, 0x70,
279 0x70, 0x6c, 0x65, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x31, 0x2c, 0x30, 0x2a,
280 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c, 0x23, 0x41, 0x70, 0x70, 0x6c, 0x65,
281 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x77, 0x69, 0x64, 0x65, 0x20, 0x44,
282 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x20, 0x52, 0x65, 0x6c,
283 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x31, 0x44, 0x30, 0x42, 0x06, 0x03,
284 0x55, 0x04, 0x03, 0x0c, 0x3b, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x57,
285 0x6f, 0x72, 0x6c, 0x64, 0x77, 0x69, 0x64, 0x65, 0x20, 0x44, 0x65, 0x76,
286 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x20, 0x52, 0x65, 0x6c, 0x61, 0x74,
287 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69,
288 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f,
289 0x72, 0x69, 0x74, 0x79, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09,
290 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03,
291 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01,
292 0x00, 0xca, 0x38, 0x54, 0xa6, 0xcb, 0x56, 0xaa, 0xc8, 0x24, 0x39, 0x48,
293 0xe9, 0x8c, 0xee, 0xec, 0x5f, 0xb8, 0x7f, 0x26, 0x91, 0xbc, 0x34, 0x53,
294 0x7a, 0xce, 0x7c, 0x63, 0x80, 0x61, 0x77, 0x64, 0x5e, 0xa5, 0x07, 0x23,
295 0xb6, 0x39, 0xfe, 0x50, 0x2d, 0x15, 0x56, 0x58, 0x70, 0x2d, 0x7e, 0xc4,
296 0x6e, 0xc1, 0x4a, 0x85, 0x3e, 0x2f, 0xf0, 0xde, 0x84, 0x1a, 0xa1, 0x57,
297 0xc9, 0xaf, 0x7b, 0x18, 0xff, 0x6a, 0xfa, 0x15, 0x12, 0x49, 0x15, 0x08,
298 0x19, 0xac, 0xaa, 0xdb, 0x2a, 0x32, 0xed, 0x96, 0x63, 0x68, 0x52, 0x15,
299 0x3d, 0x8c, 0x8a, 0xec, 0xbf, 0x6b, 0x18, 0x95, 0xe0, 0x03, 0xac, 0x01,
300 0x7d, 0x97, 0x05, 0x67, 0xce, 0x0e, 0x85, 0x95, 0x37, 0x6a, 0xed, 0x09,
301 0xb6, 0xae, 0x67, 0xcd, 0x51, 0x64, 0x9f, 0xc6, 0x5c, 0xd1, 0xbc, 0x57,
302 0x6e, 0x67, 0x35, 0x80, 0x76, 0x36, 0xa4, 0x87, 0x81, 0x6e, 0x38, 0x8f,
303 0xd8, 0x2b, 0x15, 0x4e, 0x7b, 0x25, 0xd8, 0x5a, 0xbf, 0x4e, 0x83, 0xc1,
304 0x8d, 0xd2, 0x93, 0xd5, 0x1a, 0x71, 0xb5, 0x60, 0x9c, 0x9d, 0x33, 0x4e,
305 0x55, 0xf9, 0x12, 0x58, 0x0c, 0x86, 0xb8, 0x16, 0x0d, 0xc1, 0xe5, 0x77,
306 0x45, 0x8d, 0x50, 0x48, 0xba, 0x2b, 0x2d, 0xe4, 0x94, 0x85, 0xe1, 0xe8,
307 0xc4, 0x9d, 0xc6, 0x68, 0xa5, 0xb0, 0xa3, 0xfc, 0x67, 0x7e, 0x70, 0xba,
308 0x02, 0x59, 0x4b, 0x77, 0x42, 0x91, 0x39, 0xb9, 0xf5, 0xcd, 0xe1, 0x4c,
309 0xef, 0xc0, 0x3b, 0x48, 0x8c, 0xa6, 0xe5, 0x21, 0x5d, 0xfd, 0x6a, 0x6a,
310 0xbb, 0xa7, 0x16, 0x35, 0x60, 0xd2, 0xe6, 0xad, 0xf3, 0x46, 0x29, 0xc9,
311 0xe8, 0xc3, 0x8b, 0xe9, 0x79, 0xc0, 0x6a, 0x61, 0x67, 0x15, 0xb2, 0xf0,
312 0xfd, 0xe5, 0x68, 0xbc, 0x62, 0x5f, 0x6e, 0xcf, 0x99, 0xdd, 0xef, 0x1b,
313 0x63, 0xfe, 0x92, 0x65, 0xab, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x81,
314 0xae, 0x30, 0x81, 0xab, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01,
315 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x01, 0x86, 0x30, 0x0f, 0x06, 0x03,
316 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01,
317 0xff, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14,
318 0x88, 0x27, 0x17, 0x09, 0xa9, 0xb6, 0x18, 0x60, 0x8b, 0xec, 0xeb, 0xba,
319 0xf6, 0x47, 0x59, 0xc5, 0x52, 0x54, 0xa3, 0xb7, 0x30, 0x1f, 0x06, 0x03,
320 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x2b, 0xd0, 0x69,
321 0x47, 0x94, 0x76, 0x09, 0xfe, 0xf4, 0x6b, 0x8d, 0x2e, 0x40, 0xa6, 0xf7,
322 0x47, 0x4d, 0x7f, 0x08, 0x5e, 0x30, 0x36, 0x06, 0x03, 0x55, 0x1d, 0x1f,
323 0x04, 0x2f, 0x30, 0x2d, 0x30, 0x2b, 0xa0, 0x29, 0xa0, 0x27, 0x86, 0x25,
324 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x61,
325 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x70,
326 0x6c, 0x65, 0x63, 0x61, 0x2f, 0x72, 0x6f, 0x6f, 0x74, 0x2e, 0x63, 0x72,
327 0x6c, 0x30, 0x10, 0x06, 0x0a, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x63, 0x64,
328 0x06, 0x02, 0x01, 0x04, 0x02, 0x05, 0x00, 0x30, 0x0d, 0x06, 0x09, 0x2a,
329 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82,
330 0x01, 0x01, 0x00, 0xda, 0x32, 0x00, 0x96, 0xc5, 0x54, 0x94, 0xd3, 0x3b,
331 0x82, 0x37, 0x66, 0x7d, 0x2e, 0x68, 0xd5, 0xc3, 0xc6, 0xb8, 0xcb, 0x26,
332 0x8c, 0x48, 0x90, 0xcf, 0x13, 0x24, 0x6a, 0x46, 0x8e, 0x63, 0xd4, 0xf0,
333 0xd0, 0x13, 0x06, 0xdd, 0xd8, 0xc4, 0xc1, 0x37, 0x15, 0xf2, 0x33, 0x13,
334 0x39, 0x26, 0x2d, 0xce, 0x2e, 0x55, 0x40, 0xe3, 0x0b, 0x03, 0xaf, 0xfa,
335 0x12, 0xc2, 0xe7, 0x0d, 0x21, 0xb8, 0xd5, 0x80, 0xcf, 0xac, 0x28, 0x2f,
336 0xce, 0x2d, 0xb3, 0x4e, 0xaf, 0x86, 0x19, 0x04, 0xc6, 0xe9, 0x50, 0xdd,
337 0x4c, 0x29, 0x47, 0x10, 0x23, 0xfc, 0x6c, 0xbb, 0x1b, 0x98, 0x6b, 0x48,
338 0x89, 0xe1, 0x5b, 0x9d, 0xde, 0x46, 0xdb, 0x35, 0x85, 0x35, 0xef, 0x3e,
339 0xd0, 0xe2, 0x58, 0x4b, 0x38, 0xf4, 0xed, 0x75, 0x5a, 0x1f, 0x5c, 0x70,
340 0x1d, 0x56, 0x39, 0x12, 0xe5, 0xe1, 0x0d, 0x11, 0xe4, 0x89, 0x25, 0x06,
341 0xbd, 0xd5, 0xb4, 0x15, 0x8e, 0x5e, 0xd0, 0x59, 0x97, 0x90, 0xe9, 0x4b,
342 0x81, 0xe2, 0xdf, 0x18, 0xaf, 0x44, 0x74, 0x1e, 0x19, 0xa0, 0x3a, 0x47,
343 0xcc, 0x91, 0x1d, 0x3a, 0xeb, 0x23, 0x5a, 0xfe, 0xa5, 0x2d, 0x97, 0xf7,
344 0x7b, 0xbb, 0xd6, 0x87, 0x46, 0x42, 0x85, 0xeb, 0x52, 0x3d, 0x26, 0xb2,
345 0x63, 0xa8, 0xb4, 0xb1, 0xca, 0x8f, 0xf4, 0xcc, 0xe2, 0xb3, 0xc8, 0x47,
346 0xe0, 0xbf, 0x9a, 0x59, 0x83, 0xfa, 0xda, 0x98, 0x53, 0x2a, 0x82, 0xf5,
347 0x7c, 0x65, 0x2e, 0x95, 0xd9, 0x33, 0x5d, 0xf5, 0xed, 0x65, 0xcc, 0x31,
348 0x37, 0xc5, 0x5a, 0x04, 0xe8, 0x6b, 0xe1, 0xe7, 0x88, 0x03, 0x4a, 0x75,
349 0x9e, 0x9b, 0x28, 0xcb, 0x4a, 0x40, 0x88, 0x65, 0x43, 0x75, 0xdd, 0xcb,
350 0x3a, 0x25, 0x23, 0xc5, 0x9e, 0x57, 0xf8, 0x2e, 0xce, 0xd2, 0xa9, 0x92,
351 0x5e, 0x73, 0x2e, 0x2f, 0x25, 0x75, 0x15
352 };
353
354 /* Subject: UID=AP773K8VXL, CN=iPhone Developer: Julien Oster (S64MW3JM4L), OU=M2657GZ2M9, O=Apple Inc. - OS Security, C=US
355 * Issuer: C=US, O=Apple Inc., OU=Apple Worldwide Developer Relations, CN=Apple Worldwide Developer Relations Certification Authority */
356 static const UInt8 kTestiPhoneDevCert[] = {
357 0x30, 0x82, 0x05, 0xa4, 0x30, 0x82, 0x04, 0x8c, 0xa0, 0x03, 0x02, 0x01,
358 0x02, 0x02, 0x08, 0x38, 0x3a, 0x38, 0x67, 0x79, 0xb5, 0xa4, 0xc8, 0x30,
359 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05,
360 0x05, 0x00, 0x30, 0x81, 0x96, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,
361 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03,
362 0x55, 0x04, 0x0a, 0x0c, 0x0a, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x49,
363 0x6e, 0x63, 0x2e, 0x31, 0x2c, 0x30, 0x2a, 0x06, 0x03, 0x55, 0x04, 0x0b,
364 0x0c, 0x23, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x57, 0x6f, 0x72, 0x6c,
365 0x64, 0x77, 0x69, 0x64, 0x65, 0x20, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f,
366 0x70, 0x65, 0x72, 0x20, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
367 0x73, 0x31, 0x44, 0x30, 0x42, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x3b,
368 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x77,
369 0x69, 0x64, 0x65, 0x20, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65,
370 0x72, 0x20, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20,
371 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
372 0x6e, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x30,
373 0x1e, 0x17, 0x0d, 0x31, 0x34, 0x31, 0x32, 0x31, 0x36, 0x32, 0x31, 0x31,
374 0x38, 0x30, 0x30, 0x5a, 0x17, 0x0d, 0x31, 0x35, 0x31, 0x32, 0x31, 0x36,
375 0x32, 0x31, 0x31, 0x38, 0x30, 0x30, 0x5a, 0x30, 0x81, 0x97, 0x31, 0x1a,
376 0x30, 0x18, 0x06, 0x0a, 0x09, 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64,
377 0x01, 0x01, 0x0c, 0x0a, 0x41, 0x50, 0x37, 0x37, 0x33, 0x4b, 0x38, 0x56,
378 0x58, 0x4c, 0x31, 0x34, 0x30, 0x32, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c,
379 0x2b, 0x69, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x20, 0x44, 0x65, 0x76, 0x65,
380 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x3a, 0x20, 0x4a, 0x75, 0x6c, 0x69, 0x65,
381 0x6e, 0x20, 0x4f, 0x73, 0x74, 0x65, 0x72, 0x20, 0x28, 0x53, 0x36, 0x34,
382 0x4d, 0x57, 0x33, 0x4a, 0x4d, 0x34, 0x4c, 0x29, 0x31, 0x13, 0x30, 0x11,
383 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c, 0x0a, 0x4d, 0x32, 0x36, 0x35, 0x37,
384 0x47, 0x5a, 0x32, 0x4d, 0x39, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55,
385 0x04, 0x0a, 0x0c, 0x18, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x49, 0x6e,
386 0x63, 0x2e, 0x20, 0x2d, 0x20, 0x4f, 0x53, 0x20, 0x53, 0x65, 0x63, 0x75,
387 0x72, 0x69, 0x74, 0x79, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
388 0x06, 0x13, 0x02, 0x55, 0x53, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06,
389 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00,
390 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01,
391 0x01, 0x00, 0xaf, 0x63, 0x4c, 0x3e, 0xbd, 0x24, 0xb8, 0xfe, 0xd1, 0xb7,
392 0x7e, 0xe6, 0x65, 0x91, 0xf6, 0xcf, 0xd6, 0x5f, 0xe2, 0xf5, 0xe4, 0x75,
393 0x22, 0xa4, 0xa7, 0xcd, 0x0e, 0x4a, 0x93, 0xbd, 0x26, 0x19, 0xa0, 0x55,
394 0x56, 0x58, 0xbf, 0x82, 0xb3, 0xc7, 0x69, 0xf1, 0x9b, 0x0b, 0xe8, 0xa6,
395 0xef, 0xa4, 0x85, 0xcb, 0x17, 0x15, 0xa1, 0x6d, 0x9f, 0xa8, 0x7e, 0xec,
396 0x7f, 0x45, 0x87, 0x26, 0x0a, 0x85, 0x32, 0x71, 0x5b, 0x49, 0x62, 0x92,
397 0x96, 0xa6, 0x27, 0xe4, 0x1e, 0x33, 0x0a, 0xeb, 0x15, 0x31, 0xb3, 0x31,
398 0x88, 0x99, 0x73, 0x27, 0xf5, 0x1e, 0x2b, 0x33, 0xfd, 0x84, 0x71, 0xb0,
399 0xd4, 0x84, 0xf1, 0x0b, 0x44, 0x49, 0x6a, 0x41, 0xd1, 0xc3, 0xa1, 0x4d,
400 0x18, 0xa7, 0xbb, 0x3c, 0xef, 0x80, 0xc6, 0x28, 0x14, 0x79, 0x2e, 0x6c,
401 0x99, 0xd7, 0x10, 0xd9, 0x10, 0xf5, 0xe4, 0xf1, 0x92, 0x87, 0x13, 0x21,
402 0x55, 0xa7, 0x1c, 0x90, 0xa1, 0xbb, 0x77, 0xbd, 0xee, 0xc4, 0x14, 0x35,
403 0xfe, 0x9b, 0xde, 0xfb, 0x27, 0xe1, 0x95, 0xd5, 0x14, 0x5b, 0xce, 0x8f,
404 0x11, 0xc1, 0x82, 0x18, 0x1e, 0x34, 0x47, 0x58, 0xbd, 0x71, 0x3d, 0xe5,
405 0x69, 0xde, 0xeb, 0x2c, 0xe6, 0x5c, 0x46, 0x7b, 0xd1, 0x50, 0x20, 0xe2,
406 0x86, 0x76, 0xad, 0x72, 0x4e, 0xa2, 0x3b, 0x53, 0xe6, 0xec, 0xbb, 0x57,
407 0xd5, 0xc5, 0x54, 0x0b, 0x58, 0x09, 0xc6, 0xc2, 0xe2, 0xc7, 0x5e, 0x29,
408 0x4e, 0xb2, 0x74, 0x9d, 0x87, 0x0a, 0x7c, 0x3a, 0x9e, 0x1e, 0x42, 0x60,
409 0x68, 0x62, 0xa3, 0x5d, 0x89, 0x3f, 0xa0, 0xb2, 0xdc, 0x8a, 0x50, 0xd8,
410 0x78, 0x2a, 0xb9, 0xe7, 0xb0, 0x91, 0xd7, 0x83, 0x11, 0xb4, 0xac, 0x71,
411 0x15, 0x60, 0x3d, 0xcc, 0xf8, 0x2c, 0xb4, 0x80, 0x1d, 0x19, 0xa5, 0x0d,
412 0x8f, 0xa1, 0xaf, 0x24, 0x99, 0x9f, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3,
413 0x82, 0x01, 0xf1, 0x30, 0x82, 0x01, 0xed, 0x30, 0x1d, 0x06, 0x03, 0x55,
414 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x90, 0x1f, 0x57, 0xaf, 0x17, 0xb5,
415 0xec, 0xcf, 0xee, 0x0f, 0xdb, 0x1c, 0x36, 0x9c, 0xa3, 0xe3, 0x15, 0xba,
416 0x7a, 0xb5, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff,
417 0x04, 0x02, 0x30, 0x00, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04,
418 0x18, 0x30, 0x16, 0x80, 0x14, 0x88, 0x27, 0x17, 0x09, 0xa9, 0xb6, 0x18,
419 0x60, 0x8b, 0xec, 0xeb, 0xba, 0xf6, 0x47, 0x59, 0xc5, 0x52, 0x54, 0xa3,
420 0xb7, 0x30, 0x82, 0x01, 0x0f, 0x06, 0x03, 0x55, 0x1d, 0x20, 0x04, 0x82,
421 0x01, 0x06, 0x30, 0x82, 0x01, 0x02, 0x30, 0x81, 0xff, 0x06, 0x09, 0x2a,
422 0x86, 0x48, 0x86, 0xf7, 0x63, 0x64, 0x05, 0x01, 0x30, 0x81, 0xf1, 0x30,
423 0x81, 0xc3, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x02, 0x02,
424 0x30, 0x81, 0xb6, 0x0c, 0x81, 0xb3, 0x52, 0x65, 0x6c, 0x69, 0x61, 0x6e,
425 0x63, 0x65, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x63,
426 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x62,
427 0x79, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x70, 0x61, 0x72, 0x74, 0x79, 0x20,
428 0x61, 0x73, 0x73, 0x75, 0x6d, 0x65, 0x73, 0x20, 0x61, 0x63, 0x63, 0x65,
429 0x70, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68,
430 0x65, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69,
431 0x63, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61,
432 0x72, 0x64, 0x20, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x20, 0x61, 0x6e, 0x64,
433 0x20, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20,
434 0x6f, 0x66, 0x20, 0x75, 0x73, 0x65, 0x2c, 0x20, 0x63, 0x65, 0x72, 0x74,
435 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x70, 0x6f, 0x6c, 0x69,
436 0x63, 0x79, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x63, 0x65, 0x72, 0x74, 0x69,
437 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x70, 0x72, 0x61,
438 0x63, 0x74, 0x69, 0x63, 0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x6d,
439 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x30, 0x29, 0x06, 0x08, 0x2b, 0x06, 0x01,
440 0x05, 0x05, 0x07, 0x02, 0x01, 0x16, 0x1d, 0x68, 0x74, 0x74, 0x70, 0x3a,
441 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e,
442 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x65, 0x63, 0x61, 0x2f,
443 0x30, 0x4d, 0x06, 0x03, 0x55, 0x1d, 0x1f, 0x04, 0x46, 0x30, 0x44, 0x30,
444 0x42, 0xa0, 0x40, 0xa0, 0x3e, 0x86, 0x3c, 0x68, 0x74, 0x74, 0x70, 0x3a,
445 0x2f, 0x2f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x2e,
446 0x61, 0x70, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x65,
447 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61,
448 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x2f, 0x77, 0x77, 0x64,
449 0x72, 0x63, 0x61, 0x2e, 0x63, 0x72, 0x6c, 0x30, 0x0e, 0x06, 0x03, 0x55,
450 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, 0x30,
451 0x16, 0x06, 0x03, 0x55, 0x1d, 0x25, 0x01, 0x01, 0xff, 0x04, 0x0c, 0x30,
452 0x0a, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x03, 0x30,
453 0x13, 0x06, 0x0a, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x63, 0x64, 0x06, 0x01,
454 0x02, 0x01, 0x01, 0xff, 0x04, 0x02, 0x05, 0x00, 0x30, 0x0d, 0x06, 0x09,
455 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03,
456 0x82, 0x01, 0x01, 0x00, 0x9e, 0x2c, 0xba, 0x8f, 0x18, 0xe6, 0x04, 0xa8,
457 0x03, 0x35, 0xf7, 0x56, 0x24, 0xb9, 0xfc, 0x29, 0x22, 0x86, 0x42, 0xf1,
458 0x81, 0xce, 0x82, 0x9a, 0x19, 0x4c, 0x0d, 0xb0, 0x4e, 0xe6, 0x7c, 0xd1,
459 0x06, 0xab, 0xef, 0xd3, 0x5b, 0x17, 0xdf, 0xad, 0x84, 0xa2, 0x93, 0x16,
460 0x7a, 0x51, 0xd6, 0x94, 0x4a, 0xbb, 0x7b, 0xfa, 0x97, 0x66, 0x52, 0x03,
461 0x69, 0x13, 0x14, 0x8a, 0x5c, 0x6c, 0x88, 0x45, 0x0f, 0x69, 0xd0, 0x62,
462 0x29, 0x9c, 0xc1, 0xf1, 0x72, 0x95, 0xd7, 0x48, 0x28, 0x6e, 0xe5, 0xa3,
463 0x20, 0x68, 0xba, 0xde, 0xe8, 0x88, 0x93, 0xfa, 0x20, 0x05, 0x1d, 0xee,
464 0x0e, 0xf5, 0x3f, 0x82, 0xf2, 0xc8, 0xe6, 0xc0, 0x96, 0x50, 0xba, 0x3e,
465 0x9e, 0x9d, 0x14, 0x4d, 0xd0, 0x73, 0x7c, 0xdd, 0x56, 0xf6, 0x49, 0x9c,
466 0xca, 0xb1, 0x98, 0x1e, 0x5f, 0xee, 0xe3, 0xcb, 0xbb, 0xf7, 0x9d, 0x48,
467 0x30, 0xe4, 0x6d, 0x6f, 0xfc, 0xe8, 0xbd, 0x28, 0xb6, 0x25, 0x09, 0x41,
468 0x7f, 0xd6, 0xb1, 0x7b, 0x97, 0xab, 0xc3, 0xaf, 0x66, 0xaa, 0x92, 0x17,
469 0x30, 0x13, 0x70, 0xb2, 0x23, 0x1a, 0xd8, 0x59, 0x6e, 0xe2, 0x12, 0x5d,
470 0x6a, 0x56, 0x1f, 0x56, 0xf0, 0x9d, 0x94, 0x77, 0x75, 0x21, 0x9a, 0x2f,
471 0x7d, 0x3c, 0x01, 0x92, 0x56, 0x1c, 0xf4, 0x72, 0x23, 0x94, 0xa4, 0x07,
472 0x4c, 0xd5, 0x6f, 0x71, 0x10, 0x1b, 0x7e, 0x98, 0xc2, 0xbb, 0x73, 0xbf,
473 0xc9, 0x4a, 0x42, 0x53, 0x17, 0x58, 0x09, 0x30, 0xba, 0x04, 0xf8, 0x97,
474 0x3e, 0x13, 0x4e, 0x67, 0x2d, 0xec, 0x73, 0x67, 0x10, 0x28, 0x5f, 0xd4,
475 0xda, 0xa5, 0x83, 0xbe, 0x06, 0x83, 0x07, 0xce, 0x59, 0x9d, 0x1e, 0x35,
476 0x1d, 0x66, 0x87, 0xae, 0x7a, 0x65, 0xfb, 0x76, 0x9b, 0xcf, 0xd7, 0xf1,
477 0xb7, 0x8d, 0x2f, 0x5c, 0x8e, 0xa7, 0xcc, 0x8d
478 };
479
480 static void test_with_cert(const char *name,
481 const UInt8 *cert0_bytes, CFIndex cert0_len,
482 const UInt8 *cert1_bytes, CFIndex cert1_len,
483 SecTrustResultType expectedTrustResult) {
484 CFDateRef date=NULL;
485 CFArrayRef policies=NULL;
486 SecPolicyRef policy=NULL;
487 SecTrustRef trust=NULL;
488 SecCertificateRef cert0=NULL, cert1=NULL;
489 CFMutableArrayRef certs=NULL;
490 SecTrustResultType trustResult;
491 CFIndex chainLen;
492
493 isnt(cert0 = SecCertificateCreateWithBytes(NULL, cert0_bytes, cert0_len),
494 NULL, "%s: create cert0", name);
495 isnt(cert1 = SecCertificateCreateWithBytes(NULL, cert1_bytes, cert1_len),
496 NULL, "%s: create cert1", name);
497 // these chain to the Apple Root CA so it is not provided
498
499 if (!cert0 || !cert1)
500 return;
501
502 isnt(certs = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks), NULL, "%s: create cert array", name);
503 CFArrayAppendValue(certs, cert0);
504 CFArrayAppendValue(certs, cert1);
505
506 isnt(policy = SecPolicyCreateAppleTVOSApplicationSigning(), NULL, "%s: create policy", name);
507 policies = CFArrayCreate(NULL, (const void **)&policy, 1, &kCFTypeArrayCallBacks);
508 CFRelease(policy);
509 policy = NULL;
510 ok_status(SecTrustCreateWithCertificates(certs, policies, &trust), "%s: create trust", name);
511 CFRelease(policies);
512 policies = NULL;
513 isnt(date = CFDateCreateForGregorianZuluMoment(NULL, 2014, 7, 20, 12, 0, 0),
514 NULL, "%s: create verify date", name);
515 ok_status(SecTrustSetVerifyDate(trust, date), "%s: set date", name);
516 CFReleaseSafe(date);
517 date = NULL;
518 ok_status(SecTrustEvaluate(trust, &trustResult), "%s: evaluate trust", name);
519 ok(trustResult == expectedTrustResult, "%s: trustResult unexpected (expected %d, got %d)",
520 name, (int)expectedTrustResult, (int)trustResult);
521 chainLen = SecTrustGetCertificateCount(trust);
522 ok(chainLen == 3, "%s: chain length 3 expected (got %d)", name, (int)chainLen);
523 CFRelease(trust);
524 trust = NULL;
525
526 CFReleaseSafe(cert0);
527 CFReleaseSafe(cert1);
528 CFReleaseSafe(certs);
529 }
530
531 static void tests(void)
532 {
533 // Those are the certificates which should officially pass.
534 test_with_cert("AppleTV Prod",
535 kTestAppleTVOSAppSigLeaf, sizeof(kTestAppleTVOSAppSigLeaf),
536 kTestAppleWWDRIntm, sizeof(kTestAppleWWDRIntm),
537 kSecTrustResultUnspecified);
538 test_with_cert("AppleTV Test",
539 kTestAppleTVOSAppSigTestLeaf, sizeof(kTestAppleTVOSAppSigTestLeaf),
540 kTestAppleWWDRIntm, sizeof(kTestAppleWWDRIntm),
541 kSecTrustResultUnspecified);
542
543 // An iPhone dev cert, which has a common intermediate, but not the right marker OIDs, should of course fail.
544 test_with_cert("iPhone Dev",
545 kTestiPhoneDevCert, sizeof(kTestiPhoneDevCert),
546 kTestAppleWWDRIntm, sizeof(kTestAppleWWDRIntm),
547 kSecTrustResultRecoverableTrustFailure);
548
549 }
550
551 int si_81_sectrust_appletv(int argc, char *const *argv)
552 {
553 plan_tests(30);
554
555 tests();
556
557 return 0;
558 }