]> git.saurik.com Git - apple/security.git/blob - keychain/securityd/Regressions/secd-34-backup-der-parse.m
Security-59306.61.1.tar.gz
[apple/security.git] / keychain / securityd / Regressions / secd-34-backup-der-parse.m
1 /*
2 * Copyright (c) 2008-2010,2013 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 <CoreFoundation/CoreFoundation.h>
26 #include <Security/SecBase.h>
27 #include <Security/SecItem.h>
28 #include <Security/SecItemPriv.h>
29 #include <Security/SecInternal.h>
30 #include <utilities/SecFileLocations.h>
31 #include <utilities/SecCFWrappers.h>
32 #include <Security/SecItemBackup.h>
33
34 #include <stdlib.h>
35 #include <fcntl.h>
36 #include <unistd.h>
37 #include <sys/stat.h>
38
39 #include "secd_regressions.h"
40
41 #include "keychain/securityd/SecItemServer.h"
42
43 #include "SecdTestKeychainUtilities.h"
44
45 /* Keybag and exported plist data. */
46 static const unsigned char backup_data[] = {
47 0x30, 0x82, 0x06, 0xf4, 0x04, 0x82, 0x06, 0xf0, 0x56, 0x45, 0x52, 0x53,
48 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x54, 0x59, 0x50, 0x45,
49 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x55, 0x55, 0x49, 0x44,
50 0x00, 0x00, 0x00, 0x10, 0x60, 0x5e, 0x34, 0x57, 0xbe, 0xa0, 0x48, 0xd6,
51 0x9b, 0x22, 0xfa, 0x80, 0xff, 0x3a, 0xe9, 0x9b, 0x48, 0x4d, 0x43, 0x4b,
52 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
53 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
54 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
55 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x52, 0x41, 0x50,
56 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x53, 0x41, 0x4c, 0x54,
57 0x00, 0x00, 0x00, 0x14, 0x50, 0x2e, 0x97, 0xc6, 0xfa, 0xed, 0x9b, 0xc0,
58 0x6f, 0x09, 0x2a, 0xca, 0x29, 0x38, 0x47, 0x34, 0x9f, 0xc0, 0x29, 0x7e,
59 0x49, 0x54, 0x45, 0x52, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x27, 0x10,
60 0x55, 0x55, 0x49, 0x44, 0x00, 0x00, 0x00, 0x10, 0x6f, 0x6a, 0x84, 0xd0,
61 0x73, 0x27, 0x4a, 0xbc, 0xb3, 0x28, 0xb4, 0xa4, 0xc5, 0x36, 0x4a, 0xdf,
62 0x43, 0x4c, 0x41, 0x53, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0b,
63 0x57, 0x52, 0x41, 0x50, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03,
64 0x4b, 0x54, 0x59, 0x50, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01,
65 0x57, 0x50, 0x4b, 0x59, 0x00, 0x00, 0x00, 0x28, 0x69, 0xa7, 0xb1, 0xcd,
66 0x86, 0x2c, 0xc4, 0xc4, 0x81, 0x52, 0xb3, 0xe7, 0xf9, 0x78, 0xad, 0xec,
67 0xaf, 0xc4, 0xe1, 0x71, 0xc9, 0x98, 0xca, 0xb4, 0xa8, 0x86, 0xdc, 0xe9,
68 0xcf, 0x48, 0xce, 0x82, 0xa4, 0xeb, 0xf4, 0x43, 0x6d, 0xb0, 0xee, 0x05,
69 0x50, 0x42, 0x4b, 0x59, 0x00, 0x00, 0x00, 0x20, 0xcf, 0x0b, 0x7c, 0x16,
70 0xa1, 0x69, 0x16, 0x1f, 0x52, 0x5a, 0xb5, 0x16, 0xa2, 0x75, 0xe0, 0x5f,
71 0xb2, 0x55, 0x53, 0xed, 0x10, 0xc6, 0xd1, 0x4d, 0x47, 0x65, 0xe6, 0xcb,
72 0xd0, 0x77, 0x12, 0x56, 0x55, 0x55, 0x49, 0x44, 0x00, 0x00, 0x00, 0x10,
73 0x5c, 0x1d, 0x0e, 0xde, 0x90, 0xac, 0x45, 0x1f, 0xa1, 0x10, 0x75, 0x84,
74 0xf4, 0x9c, 0xe9, 0x65, 0x43, 0x4c, 0x41, 0x53, 0x00, 0x00, 0x00, 0x04,
75 0x00, 0x00, 0x00, 0x0a, 0x57, 0x52, 0x41, 0x50, 0x00, 0x00, 0x00, 0x04,
76 0x00, 0x00, 0x00, 0x03, 0x4b, 0x54, 0x59, 0x50, 0x00, 0x00, 0x00, 0x04,
77 0x00, 0x00, 0x00, 0x01, 0x57, 0x50, 0x4b, 0x59, 0x00, 0x00, 0x00, 0x28,
78 0xdd, 0xd8, 0xfa, 0x79, 0x6a, 0x6a, 0x63, 0xfc, 0x40, 0xf2, 0xa9, 0x1d,
79 0xe9, 0xf1, 0xf6, 0xdb, 0x14, 0xc4, 0x55, 0x52, 0x80, 0x2e, 0xe3, 0x48,
80 0x91, 0x53, 0x17, 0xd9, 0xb6, 0x91, 0x05, 0x42, 0x25, 0xa3, 0xb8, 0xc7,
81 0x95, 0x21, 0x14, 0xb7, 0x50, 0x42, 0x4b, 0x59, 0x00, 0x00, 0x00, 0x20,
82 0x48, 0xb5, 0xd3, 0xe5, 0xdb, 0xc5, 0x3b, 0x20, 0x23, 0x35, 0x4f, 0xd4,
83 0x28, 0xe5, 0x43, 0x59, 0xaf, 0x74, 0xd3, 0x40, 0xd3, 0x24, 0x7c, 0x0a,
84 0xe7, 0x86, 0x9e, 0xde, 0x96, 0x6d, 0xdb, 0x3a, 0x55, 0x55, 0x49, 0x44,
85 0x00, 0x00, 0x00, 0x10, 0xc7, 0x1f, 0xde, 0xb6, 0xb0, 0x49, 0x42, 0x90,
86 0x90, 0x32, 0xbf, 0x39, 0x84, 0x9d, 0xb3, 0xa1, 0x43, 0x4c, 0x41, 0x53,
87 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x09, 0x57, 0x52, 0x41, 0x50,
88 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x4b, 0x54, 0x59, 0x50,
89 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x57, 0x50, 0x4b, 0x59,
90 0x00, 0x00, 0x00, 0x28, 0xc7, 0xbd, 0xb5, 0x0a, 0x70, 0x1a, 0xe6, 0xfb,
91 0x39, 0x0a, 0x4a, 0x2d, 0x45, 0xf9, 0x5f, 0xb1, 0xc8, 0xdc, 0x88, 0x1a,
92 0x26, 0xf1, 0xaa, 0x1a, 0xb5, 0xd9, 0xbf, 0xce, 0x1f, 0x7e, 0x69, 0xb2,
93 0xdc, 0xbe, 0x48, 0x59, 0xea, 0xf0, 0x04, 0xba, 0x50, 0x42, 0x4b, 0x59,
94 0x00, 0x00, 0x00, 0x20, 0x93, 0x26, 0xff, 0x91, 0xd0, 0x28, 0x45, 0x27,
95 0x4c, 0xf0, 0x83, 0xa4, 0x39, 0x38, 0x30, 0xb5, 0x62, 0x18, 0xdc, 0xe2,
96 0x9a, 0x50, 0xf7, 0xd4, 0x01, 0x38, 0xa0, 0x61, 0x69, 0x2b, 0x38, 0x6c,
97 0x55, 0x55, 0x49, 0x44, 0x00, 0x00, 0x00, 0x10, 0xdc, 0x23, 0x9d, 0x5c,
98 0xdd, 0xf6, 0x4c, 0xa0, 0xbf, 0x63, 0x6e, 0xe8, 0x40, 0xaa, 0x43, 0xbf,
99 0x43, 0x4c, 0x41, 0x53, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08,
100 0x57, 0x52, 0x41, 0x50, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02,
101 0x4b, 0x54, 0x59, 0x50, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01,
102 0x57, 0x50, 0x4b, 0x59, 0x00, 0x00, 0x00, 0x28, 0x68, 0xf5, 0x29, 0x43,
103 0x1c, 0x42, 0x59, 0x83, 0xb8, 0x0d, 0x12, 0xf6, 0x7f, 0x6d, 0x66, 0xbe,
104 0xdd, 0xaf, 0x05, 0x90, 0x52, 0xe7, 0x03, 0xea, 0x8a, 0x03, 0xc2, 0x6f,
105 0x9c, 0x47, 0xb1, 0xea, 0x88, 0x08, 0x19, 0x2d, 0x00, 0x3b, 0x5b, 0x79,
106 0x50, 0x42, 0x4b, 0x59, 0x00, 0x00, 0x00, 0x20, 0xb4, 0x25, 0xc5, 0xa3,
107 0x85, 0xe4, 0x62, 0x53, 0x62, 0xd7, 0x0c, 0x69, 0xb9, 0x6d, 0x04, 0xe0,
108 0x5a, 0xbf, 0x1a, 0x79, 0xa5, 0x48, 0x26, 0x67, 0x9e, 0x3a, 0xc8, 0x42,
109 0x18, 0xca, 0x75, 0x0c, 0x55, 0x55, 0x49, 0x44, 0x00, 0x00, 0x00, 0x10,
110 0xb5, 0xc8, 0x18, 0xb8, 0x8f, 0xea, 0x40, 0xe7, 0x88, 0xcd, 0xf4, 0xc5,
111 0x96, 0xb8, 0x92, 0xf1, 0x43, 0x4c, 0x41, 0x53, 0x00, 0x00, 0x00, 0x04,
112 0x00, 0x00, 0x00, 0x07, 0x57, 0x52, 0x41, 0x50, 0x00, 0x00, 0x00, 0x04,
113 0x00, 0x00, 0x00, 0x02, 0x4b, 0x54, 0x59, 0x50, 0x00, 0x00, 0x00, 0x04,
114 0x00, 0x00, 0x00, 0x01, 0x57, 0x50, 0x4b, 0x59, 0x00, 0x00, 0x00, 0x28,
115 0xaa, 0x8a, 0x3c, 0x92, 0xea, 0x65, 0xa9, 0xdb, 0x3a, 0x36, 0x01, 0x54,
116 0x2e, 0x62, 0xc6, 0xd2, 0x46, 0x75, 0x61, 0xac, 0x5d, 0xbb, 0x62, 0xaa,
117 0xc3, 0xed, 0xbf, 0x14, 0x35, 0x13, 0x21, 0x2f, 0x47, 0x7d, 0x57, 0x07,
118 0xf1, 0x80, 0xa4, 0xcc, 0x50, 0x42, 0x4b, 0x59, 0x00, 0x00, 0x00, 0x20,
119 0x3e, 0xb4, 0x78, 0x54, 0xd2, 0x19, 0xaf, 0xe4, 0x4c, 0x84, 0x02, 0xd0,
120 0xf4, 0x50, 0xde, 0xd6, 0x44, 0xc9, 0xdf, 0x4b, 0x8d, 0x81, 0x2a, 0x2d,
121 0xbb, 0xf1, 0x94, 0xd0, 0x4e, 0x57, 0xfa, 0x4e, 0x55, 0x55, 0x49, 0x44,
122 0x00, 0x00, 0x00, 0x10, 0x59, 0x3c, 0xc5, 0xc5, 0xf2, 0x39, 0x4a, 0x44,
123 0x90, 0xd4, 0xb1, 0x07, 0x17, 0x00, 0x64, 0x34, 0x43, 0x4c, 0x41, 0x53,
124 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x06, 0x57, 0x52, 0x41, 0x50,
125 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x4b, 0x54, 0x59, 0x50,
126 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x57, 0x50, 0x4b, 0x59,
127 0x00, 0x00, 0x00, 0x28, 0x79, 0xdd, 0x59, 0x01, 0x1f, 0x45, 0xe4, 0x01,
128 0x32, 0xb5, 0xae, 0x5e, 0x17, 0xd7, 0x6c, 0xc6, 0x1d, 0x28, 0xf0, 0x32,
129 0x4a, 0x18, 0xff, 0x30, 0x2c, 0xe4, 0xcb, 0x7c, 0x58, 0x53, 0x00, 0x8b,
130 0xb9, 0xdd, 0x71, 0x5f, 0xbc, 0x66, 0x9b, 0x4c, 0x50, 0x42, 0x4b, 0x59,
131 0x00, 0x00, 0x00, 0x20, 0xc3, 0x2d, 0xc7, 0x4f, 0xb1, 0x7b, 0x3c, 0x9d,
132 0xcb, 0xf4, 0xd6, 0x45, 0x20, 0x35, 0xbc, 0x3a, 0x6c, 0x13, 0x1d, 0x7c,
133 0x63, 0x53, 0x17, 0xc9, 0x84, 0x86, 0xbd, 0x96, 0xb0, 0xa4, 0x39, 0x03,
134 0x55, 0x55, 0x49, 0x44, 0x00, 0x00, 0x00, 0x10, 0xcb, 0x2c, 0x33, 0x2e,
135 0x69, 0x39, 0x43, 0xe5, 0x87, 0xbb, 0xbc, 0xd4, 0x47, 0xa4, 0x86, 0x7b,
136 0x43, 0x4c, 0x41, 0x53, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05,
137 0x57, 0x52, 0x41, 0x50, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03,
138 0x4b, 0x54, 0x59, 0x50, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01,
139 0x57, 0x50, 0x4b, 0x59, 0x00, 0x00, 0x00, 0x28, 0x6f, 0x62, 0x11, 0xb0,
140 0xdf, 0x5a, 0x39, 0x43, 0xe9, 0xc3, 0xc5, 0x0b, 0x1c, 0x57, 0x6f, 0x79,
141 0x0d, 0x44, 0x9f, 0x44, 0xf2, 0x51, 0x1e, 0x68, 0xb8, 0xcf, 0x5c, 0x6d,
142 0x94, 0x86, 0x86, 0x70, 0x12, 0xc1, 0x76, 0xc0, 0x18, 0xe4, 0x58, 0x1a,
143 0x50, 0x42, 0x4b, 0x59, 0x00, 0x00, 0x00, 0x20, 0x6f, 0xba, 0xbd, 0x37,
144 0x58, 0x5f, 0x96, 0x4d, 0x4c, 0x92, 0xbb, 0xf0, 0x43, 0xec, 0x84, 0xc3,
145 0x68, 0x75, 0xf1, 0xd2, 0x04, 0x0d, 0xda, 0x8a, 0xec, 0xac, 0x02, 0xf7,
146 0xf7, 0x4d, 0xf4, 0x0e, 0x55, 0x55, 0x49, 0x44, 0x00, 0x00, 0x00, 0x10,
147 0x8d, 0xa4, 0xb5, 0x6b, 0x95, 0x12, 0x46, 0xff, 0x9e, 0x1f, 0xdd, 0x2f,
148 0xc0, 0x60, 0xc6, 0xd6, 0x43, 0x4c, 0x41, 0x53, 0x00, 0x00, 0x00, 0x04,
149 0x00, 0x00, 0x00, 0x04, 0x57, 0x52, 0x41, 0x50, 0x00, 0x00, 0x00, 0x04,
150 0x00, 0x00, 0x00, 0x02, 0x4b, 0x54, 0x59, 0x50, 0x00, 0x00, 0x00, 0x04,
151 0x00, 0x00, 0x00, 0x01, 0x57, 0x50, 0x4b, 0x59, 0x00, 0x00, 0x00, 0x28,
152 0xa8, 0xa2, 0x8d, 0xe2, 0x16, 0xd8, 0xce, 0x18, 0x2c, 0x8e, 0xa4, 0x8d,
153 0x32, 0xba, 0x83, 0xdb, 0x5e, 0xc8, 0x04, 0x59, 0x72, 0xca, 0x72, 0xe5,
154 0x6f, 0xcd, 0x06, 0x98, 0xde, 0x4b, 0xcf, 0xa6, 0xd1, 0xe3, 0xba, 0x9b,
155 0x68, 0xa6, 0xe5, 0xa2, 0x50, 0x42, 0x4b, 0x59, 0x00, 0x00, 0x00, 0x20,
156 0x46, 0x45, 0x3a, 0xc1, 0x62, 0x14, 0xd7, 0x3f, 0x8c, 0x7a, 0x66, 0x1d,
157 0x4b, 0x5c, 0x86, 0x43, 0x75, 0xe6, 0x93, 0xf1, 0x31, 0x6b, 0x20, 0x8b,
158 0x18, 0x87, 0x84, 0xcc, 0x92, 0xfc, 0xb3, 0x32, 0x55, 0x55, 0x49, 0x44,
159 0x00, 0x00, 0x00, 0x10, 0xd8, 0x36, 0xc5, 0xf9, 0x76, 0x4b, 0x4c, 0x2c,
160 0x8c, 0xaa, 0xf4, 0x62, 0xab, 0x14, 0xd5, 0x08, 0x43, 0x4c, 0x41, 0x53,
161 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x57, 0x52, 0x41, 0x50,
162 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x4b, 0x54, 0x59, 0x50,
163 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x57, 0x50, 0x4b, 0x59,
164 0x00, 0x00, 0x00, 0x28, 0x0c, 0xe1, 0xb2, 0xee, 0x08, 0xdb, 0xe4, 0xee,
165 0xb5, 0x49, 0xd5, 0x3a, 0xe7, 0xd9, 0xbd, 0xf6, 0xab, 0x0e, 0x1a, 0x2a,
166 0x16, 0x6c, 0x82, 0x88, 0x5e, 0x39, 0xf6, 0x89, 0xcf, 0x5c, 0x69, 0x3c,
167 0x67, 0x56, 0x16, 0xa1, 0x2c, 0xf4, 0x7d, 0xb9, 0x50, 0x42, 0x4b, 0x59,
168 0x00, 0x00, 0x00, 0x20, 0xc1, 0x54, 0xd5, 0xb9, 0xf1, 0x16, 0xe9, 0xb2,
169 0x9b, 0x79, 0x73, 0x7a, 0xb7, 0x95, 0x0a, 0xdb, 0x15, 0x20, 0x4d, 0xa7,
170 0x0f, 0x5d, 0xed, 0x1c, 0x95, 0x63, 0xec, 0xf8, 0xf0, 0xf2, 0x30, 0x75,
171 0x55, 0x55, 0x49, 0x44, 0x00, 0x00, 0x00, 0x10, 0x48, 0xf3, 0x98, 0x06,
172 0xfe, 0xb8, 0x4e, 0xd6, 0xa9, 0xb3, 0xe1, 0xa2, 0x1f, 0xb0, 0x7b, 0xcd,
173 0x43, 0x4c, 0x41, 0x53, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02,
174 0x57, 0x52, 0x41, 0x50, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02,
175 0x4b, 0x54, 0x59, 0x50, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01,
176 0x57, 0x50, 0x4b, 0x59, 0x00, 0x00, 0x00, 0x28, 0x01, 0x8a, 0x2c, 0x90,
177 0x67, 0x3f, 0xe0, 0xf8, 0xb1, 0xbb, 0x86, 0x7f, 0xdc, 0xcd, 0xfd, 0x22,
178 0x98, 0x54, 0x30, 0x75, 0x49, 0xd1, 0xe8, 0xc2, 0x85, 0x51, 0x5b, 0xae,
179 0xfa, 0x3f, 0xf8, 0xfc, 0xf8, 0xa6, 0xf9, 0xa0, 0x80, 0xa5, 0x3b, 0x87,
180 0x50, 0x42, 0x4b, 0x59, 0x00, 0x00, 0x00, 0x20, 0xa6, 0x4f, 0x13, 0x8a,
181 0x52, 0xe5, 0x5a, 0x65, 0x69, 0xd4, 0x70, 0xc8, 0xc7, 0xec, 0xbd, 0x27,
182 0x3a, 0xcd, 0xd0, 0xb4, 0x61, 0x5d, 0xf4, 0x81, 0x67, 0xe5, 0x63, 0x77,
183 0xbd, 0x4d, 0xb5, 0x0f, 0x55, 0x55, 0x49, 0x44, 0x00, 0x00, 0x00, 0x10,
184 0xa9, 0x3b, 0xd2, 0x02, 0x4f, 0x72, 0x46, 0x32, 0x99, 0xa6, 0x7b, 0x62,
185 0xaa, 0x11, 0xf4, 0x67, 0x43, 0x4c, 0x41, 0x53, 0x00, 0x00, 0x00, 0x04,
186 0x00, 0x00, 0x00, 0x01, 0x57, 0x52, 0x41, 0x50, 0x00, 0x00, 0x00, 0x04,
187 0x00, 0x00, 0x00, 0x02, 0x4b, 0x54, 0x59, 0x50, 0x00, 0x00, 0x00, 0x04,
188 0x00, 0x00, 0x00, 0x01, 0x57, 0x50, 0x4b, 0x59, 0x00, 0x00, 0x00, 0x28,
189 0x8d, 0xae, 0x30, 0xf1, 0x0f, 0x88, 0x7a, 0x8a, 0xb7, 0x34, 0xc9, 0x50,
190 0x02, 0x20, 0x40, 0x3c, 0xce, 0xd2, 0xa9, 0xe7, 0x5a, 0x3a, 0xad, 0xad,
191 0xac, 0xdc, 0x3a, 0xc2, 0x92, 0x9d, 0x33, 0x7a, 0x73, 0x78, 0x8a, 0x37,
192 0x04, 0x2b, 0xbd, 0xf2, 0x50, 0x42, 0x4b, 0x59, 0x00, 0x00, 0x00, 0x20,
193 0x72, 0x9c, 0x52, 0x44, 0xf0, 0xdd, 0xe1, 0x4a, 0x9e, 0x7b, 0x99, 0xec,
194 0x64, 0x66, 0x5d, 0xde, 0xe4, 0x8d, 0x72, 0x87, 0xee, 0xd8, 0x66, 0xad,
195 0x7d, 0x06, 0x0c, 0x98, 0xc9, 0x2f, 0xfb, 0x19, 0x31, 0x82, 0x03, 0x14,
196 0x30, 0x0d, 0x0c, 0x05, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x0c, 0x04, 0x67,
197 0x65, 0x6e, 0x70, 0x30, 0x1c, 0x0c, 0x04, 0x68, 0x61, 0x73, 0x68, 0x04,
198 0x14, 0xac, 0x28, 0x52, 0x3c, 0xba, 0x05, 0xe5, 0xbd, 0x68, 0x3d, 0xd2,
199 0x4c, 0xfb, 0x66, 0x80, 0xb3, 0xdf, 0xdc, 0x1f, 0x0f, 0x30, 0x82, 0x02,
200 0xe3, 0x0c, 0x04, 0x64, 0x61, 0x74, 0x61, 0x04, 0x82, 0x02, 0xd9, 0x03,
201 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0xf1,
202 0xa8, 0xb7, 0x9d, 0x4b, 0xb4, 0x44, 0x5b, 0xb7, 0x75, 0x4e, 0x73, 0x60,
203 0xd9, 0xa9, 0x40, 0x08, 0xb0, 0xd9, 0x40, 0xd2, 0x9a, 0x01, 0xf1, 0x58,
204 0x87, 0x0d, 0xb2, 0x37, 0xee, 0x3a, 0x76, 0xbe, 0x3c, 0x31, 0x6c, 0x93,
205 0xa2, 0xd0, 0x8e, 0xf7, 0x5c, 0x97, 0x25, 0x69, 0xbc, 0xd1, 0x52, 0x73,
206 0x32, 0xf4, 0x38, 0x13, 0xda, 0x86, 0xab, 0x6f, 0xe9, 0x6c, 0x4a, 0xeb,
207 0xc4, 0x7a, 0xd8, 0x53, 0x03, 0x86, 0x48, 0x4f, 0x11, 0x1a, 0x1b, 0xa9,
208 0x17, 0x21, 0xc3, 0x97, 0x12, 0xb6, 0x77, 0x03, 0xba, 0x22, 0x96, 0x0a,
209 0x90, 0x01, 0x84, 0xd6, 0x5e, 0x2e, 0x3e, 0x8e, 0x50, 0xb7, 0x48, 0x38,
210 0xb6, 0x7f, 0x77, 0x08, 0xf1, 0x2e, 0x5f, 0x3e, 0xda, 0x67, 0xff, 0xa4,
211 0x82, 0x89, 0xad, 0xfa, 0x46, 0x38, 0x23, 0x35, 0xb3, 0x8f, 0x5d, 0x31,
212 0x2e, 0x39, 0x08, 0x0a, 0x90, 0xe5, 0x5b, 0xf0, 0xc6, 0xb2, 0xa9, 0x8a,
213 0x6f, 0x31, 0x5a, 0xbd, 0x6f, 0x74, 0x17, 0x67, 0xb4, 0x0c, 0x4b, 0xd8,
214 0xf6, 0x4d, 0x25, 0xca, 0x06, 0xc0, 0x95, 0xf5, 0x70, 0x16, 0xb9, 0x49,
215 0xbd, 0xaa, 0x73, 0xb5, 0xed, 0x4d, 0xb1, 0x92, 0x78, 0x28, 0xf7, 0x0d,
216 0xbb, 0x73, 0x3d, 0x24, 0x78, 0x19, 0x55, 0xbb, 0x9b, 0x4e, 0xe6, 0x3b,
217 0x84, 0x69, 0xd5, 0xbd, 0x3a, 0xcb, 0x8c, 0x70, 0x28, 0x10, 0x8c, 0x5c,
218 0xfe, 0xb1, 0x0a, 0x2a, 0x7f, 0xb9, 0xbb, 0x32, 0xab, 0xc5, 0xf6, 0xfd,
219 0x66, 0xb7, 0xf7, 0xce, 0x63, 0xcc, 0x05, 0x25, 0xd0, 0x0b, 0x37, 0x94,
220 0xbc, 0x1f, 0x0d, 0x80, 0x6b, 0x6c, 0xfd, 0x5a, 0x62, 0xd6, 0xca, 0x3e,
221 0x9a, 0x5f, 0x23, 0xfd, 0xc6, 0x9b, 0x65, 0xd4, 0x2a, 0x80, 0x51, 0x45,
222 0x08, 0xe6, 0xc8, 0x20, 0x16, 0xb0, 0xb8, 0xc6, 0xee, 0x17, 0xb5, 0x6f,
223 0x6f, 0xb5, 0x75, 0xb3, 0x14, 0x03, 0x68, 0xab, 0x99, 0x69, 0xf8, 0x87,
224 0x70, 0x5c, 0x6f, 0x45, 0x7b, 0x49, 0xee, 0xb6, 0xbb, 0x3c, 0x0c, 0x50,
225 0x90, 0x7c, 0x4c, 0xab, 0xca, 0x81, 0x80, 0x48, 0x5d, 0x13, 0xa2, 0x9e,
226 0xf6, 0xfd, 0x2d, 0x57, 0x1d, 0xf0, 0x01, 0xc0, 0x7e, 0x69, 0x69, 0x83,
227 0x81, 0x25, 0x70, 0x81, 0x66, 0x26, 0xa3, 0x0f, 0xb7, 0x56, 0x27, 0xcd,
228 0x3b, 0x30, 0x45, 0x97, 0x5c, 0x69, 0x56, 0xa1, 0x22, 0x94, 0x87, 0x4b,
229 0xd2, 0xf3, 0xc3, 0x92, 0x6d, 0x7d, 0xe3, 0x04, 0x0b, 0xa7, 0x07, 0x42,
230 0x9e, 0x58, 0xd0, 0xbf, 0xa2, 0xd2, 0x52, 0xf2, 0xc5, 0xdd, 0xe7, 0x1f,
231 0x2e, 0x01, 0x8b, 0xd5, 0xb5, 0x48, 0xb0, 0x94, 0xfb, 0xc4, 0xf8, 0x44,
232 0x6c, 0xde, 0xbb, 0x6a, 0xf7, 0xd7, 0x9f, 0x2f, 0x33, 0x07, 0xca, 0xa6,
233 0x70, 0x76, 0x58, 0x33, 0x51, 0x6f, 0x34, 0xf8, 0x5e, 0xbf, 0x84, 0xb4,
234 0x6e, 0x56, 0x47, 0x12, 0xa2, 0xd1, 0xa1, 0xbb, 0xf1, 0xed, 0x41, 0xd7,
235 0x54, 0x49, 0xec, 0x0e, 0x5f, 0x65, 0x84, 0x8e, 0xbe, 0xa0, 0x2a, 0xaa,
236 0xe7, 0xff, 0xf3, 0xc0, 0x9d, 0x07, 0xc9, 0xe4, 0xfd, 0x9c, 0x78, 0x6f,
237 0x94, 0x9a, 0xab, 0xe5, 0x4b, 0x41, 0x0c, 0x5b, 0x18, 0x40, 0x2c, 0xca,
238 0x45, 0xd0, 0x91, 0xc3, 0x99, 0xfa, 0xc1, 0x99, 0xf5, 0x37, 0xf6, 0x2f,
239 0x7c, 0x46, 0x4b, 0xea, 0xb9, 0x13, 0xf7, 0x34, 0x31, 0x90, 0x68, 0xa0,
240 0xa5, 0x41, 0xfe, 0x45, 0xcd, 0x47, 0x62, 0x9d, 0x92, 0x8a, 0xf6, 0x0b,
241 0xdd, 0x26, 0x13, 0x98, 0x8e, 0x8b, 0x42, 0xd9, 0x6c, 0x72, 0x61, 0x07,
242 0x05, 0xf0, 0x7f, 0xe0, 0x44, 0x44, 0x02, 0x23, 0xf0, 0x33, 0xc2, 0xe1,
243 0x5c, 0x85, 0x57, 0xc8, 0x4a, 0x73, 0xf4, 0x09, 0xba, 0xbd, 0x6f, 0xd0,
244 0x3f, 0x76, 0x23, 0xd6, 0x14, 0x81, 0x07, 0x05, 0x08, 0xdb, 0x73, 0x43,
245 0x65, 0xfd, 0xcf, 0x4f, 0x93, 0xdd, 0xe6, 0x44, 0x5e, 0xed, 0x1b, 0xf5,
246 0x5d, 0x9e, 0xc3, 0xc1, 0x4d, 0x6b, 0x5c, 0xa2, 0xf7, 0x60, 0xd8, 0xb6,
247 0x6e, 0x3e, 0xe8, 0x32, 0xc6, 0x24, 0xbb, 0xae, 0xa6, 0x3b, 0x1d, 0x6a,
248 0x06, 0x3c, 0x2c, 0x6b, 0x4a, 0x33, 0x4d, 0x6c, 0xd6, 0xc4, 0x1b, 0xb2,
249 0x2e, 0xcc, 0x92, 0x1b, 0xc8, 0xd4, 0xdd, 0xd8, 0x18, 0x1a, 0x1b, 0x9b,
250 0xb4, 0xc7, 0xf7, 0xcc, 0xbb, 0x67, 0x02, 0x40, 0x94, 0x82, 0x36, 0xa4,
251 0x3c, 0x3d, 0x6a, 0xf2, 0xcf, 0x58, 0x67, 0x7d, 0x7f, 0xd0, 0x17, 0x01,
252 0xdf, 0xe4, 0xc3, 0xf7, 0x2d, 0x9d, 0x69, 0x19, 0x36, 0x3a, 0x9f, 0xcb,
253 0xd5, 0x09, 0xf7, 0x4c, 0x61, 0x06, 0x59, 0xf9, 0x0b, 0x89, 0x9e, 0x73,
254 0x9f, 0x44, 0x4e, 0x2e, 0x3d, 0xc0, 0xdd, 0xae, 0x70, 0x36, 0x58, 0x11,
255 0xab, 0x0d, 0x73, 0xc2, 0x24, 0x45, 0x7d, 0x5e, 0xd2, 0x6a, 0xc0, 0xa1,
256 0x0e, 0x86, 0x52, 0x01, 0xe8, 0xea, 0xce, 0x80, 0x97, 0x9f, 0xfa, 0x69,
257 0xb9, 0x2d, 0x9a, 0xd3, 0xd9, 0xee, 0xc4, 0x36, 0xc7, 0x61, 0xdd, 0xe0,
258 0xe7, 0xb4, 0xbe, 0x81, 0x54, 0x92, 0x89, 0x44, 0x9f, 0x3b, 0x77, 0x9b,
259 0xcd, 0x17, 0xf2, 0x48, 0xd7, 0x1a, 0x46, 0xaf, 0x88, 0x9c, 0x0f, 0xc1,
260 0x2b, 0x1e, 0x3d, 0xe5, 0x8e, 0xb3, 0x9b, 0xa0, 0x4b, 0xe6, 0x3f, 0xf4,
261 0x27, 0xc4, 0xc9, 0x2c, 0x23, 0xc0, 0x26, 0xf3, 0x02, 0x02, 0x03, 0xe7,
262 0x31, 0x82, 0x03, 0x14, 0x30, 0x0d, 0x0c, 0x05, 0x63, 0x6c, 0x61, 0x73,
263 0x73, 0x0c, 0x04, 0x67, 0x65, 0x6e, 0x70, 0x30, 0x1c, 0x0c, 0x04, 0x68,
264 0x61, 0x73, 0x68, 0x04, 0x14, 0x20, 0x5a, 0x6b, 0x14, 0x4b, 0x34, 0x12,
265 0xc6, 0x71, 0x8c, 0xe4, 0xa8, 0x07, 0x83, 0x0e, 0xe0, 0x6f, 0x2d, 0xe6,
266 0x13, 0x30, 0x82, 0x02, 0xe3, 0x0c, 0x04, 0x64, 0x61, 0x74, 0x61, 0x04,
267 0x82, 0x02, 0xd9, 0x03, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x48,
268 0x00, 0x00, 0x00, 0x0d, 0x9c, 0x25, 0x6a, 0x30, 0x5b, 0x92, 0x39, 0xe8,
269 0x4c, 0x61, 0x06, 0x44, 0x0f, 0xb1, 0x58, 0x6f, 0x0f, 0x5f, 0x4c, 0x8d,
270 0xdb, 0x59, 0x69, 0x90, 0xd4, 0x2f, 0x4e, 0x78, 0xa9, 0x62, 0x1d, 0xbc,
271 0xad, 0x25, 0x38, 0xb7, 0x05, 0xa3, 0x79, 0x94, 0xc7, 0x2c, 0x4f, 0x67,
272 0xf3, 0x76, 0xf4, 0xf8, 0x58, 0x34, 0x85, 0x80, 0x2e, 0x3c, 0x90, 0xef,
273 0xe7, 0xc2, 0x08, 0xd7, 0x6a, 0xdd, 0xba, 0xae, 0x55, 0x27, 0xd3, 0x42,
274 0x27, 0x5d, 0x7e, 0x0e, 0xe5, 0x8e, 0xe9, 0xd5, 0x42, 0x3b, 0x48, 0x70,
275 0x40, 0x25, 0xf5, 0xbe, 0xb6, 0x4e, 0x10, 0xf7, 0xe5, 0x60, 0x9d, 0xd7,
276 0x8b, 0x63, 0x40, 0xf0, 0x8b, 0xa2, 0xf3, 0xd6, 0x04, 0xaf, 0x54, 0xa5,
277 0xeb, 0x52, 0x80, 0x1a, 0xa8, 0xe0, 0xf7, 0x9b, 0x45, 0x94, 0x36, 0xee,
278 0x40, 0xfd, 0xad, 0x2c, 0xf0, 0x92, 0x8e, 0x4a, 0x98, 0x80, 0xed, 0x43,
279 0xd3, 0x17, 0xa6, 0xab, 0x96, 0xb4, 0x17, 0x1e, 0xab, 0xb4, 0x6b, 0x74,
280 0x43, 0x7c, 0xd9, 0xe1, 0x66, 0x6f, 0x07, 0x20, 0x53, 0x66, 0xe6, 0x60,
281 0xbf, 0x92, 0x73, 0x46, 0xfb, 0xb0, 0x81, 0xea, 0xf2, 0xac, 0x13, 0xf7,
282 0xbb, 0xd4, 0x38, 0x1b, 0x64, 0xd3, 0xc3, 0x34, 0x37, 0x2c, 0xbc, 0x7d,
283 0x36, 0x88, 0xb1, 0x90, 0xcd, 0x9e, 0xee, 0xaf, 0xcb, 0x63, 0x3f, 0x8a,
284 0xf5, 0x1a, 0xfc, 0x21, 0xb2, 0xf0, 0xc0, 0x60, 0x72, 0xc7, 0xf0, 0x54,
285 0x3e, 0x88, 0x4c, 0x69, 0x96, 0xc2, 0x2b, 0x25, 0x96, 0x41, 0x05, 0xd7,
286 0xc6, 0x89, 0xe8, 0x33, 0x1c, 0x7a, 0x88, 0x81, 0xfe, 0xb2, 0x3d, 0x6f,
287 0x60, 0x43, 0x1e, 0x62, 0x48, 0x76, 0xd2, 0xe6, 0xfb, 0x22, 0x8a, 0x5d,
288 0xe6, 0xd8, 0xe2, 0x30, 0x51, 0x2f, 0xcc, 0xab, 0xb0, 0x31, 0x68, 0x43,
289 0x51, 0x11, 0x67, 0x09, 0x3c, 0x34, 0x7e, 0x49, 0xe0, 0xe0, 0xd4, 0x74,
290 0xe4, 0x17, 0x42, 0x32, 0x76, 0x3a, 0x2f, 0xc1, 0x8a, 0xb3, 0xfc, 0xdc,
291 0x54, 0x00, 0x05, 0x00, 0x8b, 0x07, 0x70, 0xbb, 0xc1, 0x97, 0x33, 0x9f,
292 0x93, 0x2c, 0xc1, 0xc8, 0x3b, 0xfb, 0x99, 0xe8, 0x3e, 0x60, 0x20, 0x7d,
293 0xb7, 0x77, 0x20, 0x61, 0xda, 0xfb, 0x66, 0xa9, 0x0e, 0x5c, 0x65, 0x30,
294 0x4d, 0x39, 0x6b, 0x39, 0xb6, 0xe3, 0x16, 0xc2, 0x01, 0x2b, 0x0d, 0x0b,
295 0x95, 0xa7, 0x45, 0x40, 0xb8, 0x93, 0xaf, 0x97, 0x8c, 0x63, 0xab, 0x4f,
296 0x9e, 0x90, 0x98, 0xda, 0xe7, 0x84, 0x41, 0xcc, 0xed, 0xb5, 0xc0, 0x35,
297 0xa6, 0x1b, 0xe5, 0x51, 0x7f, 0xaa, 0x44, 0xd0, 0x32, 0x0c, 0x04, 0xfa,
298 0x34, 0x4d, 0xb4, 0x3a, 0xd0, 0x4e, 0xc8, 0xcb, 0x6d, 0x98, 0x42, 0xad,
299 0xc4, 0xe3, 0x38, 0x39, 0xc8, 0x21, 0x6a, 0xb5, 0x7f, 0x00, 0x99, 0x58,
300 0x69, 0x5e, 0xd8, 0xe7, 0x43, 0x09, 0x7f, 0x7d, 0x65, 0xe9, 0xe1, 0x1e,
301 0xa8, 0x60, 0x83, 0x5b, 0xa9, 0x87, 0xca, 0xe6, 0xf4, 0x27, 0xab, 0x93,
302 0x8b, 0x43, 0x34, 0xdf, 0xd5, 0x3a, 0x36, 0x19, 0x19, 0x2f, 0x53, 0xef,
303 0x8d, 0xa2, 0x4c, 0x29, 0x84, 0xe7, 0x0e, 0x52, 0xb4, 0x0c, 0x4c, 0xe1,
304 0x90, 0xef, 0xd7, 0xd9, 0xb8, 0xb9, 0xd3, 0x46, 0xcf, 0x69, 0xd6, 0x35,
305 0x59, 0xed, 0x0d, 0x02, 0xc7, 0xa7, 0xf2, 0x6b, 0x5e, 0xdd, 0x86, 0x52,
306 0xc2, 0x85, 0xc2, 0x92, 0x69, 0x04, 0x51, 0x93, 0x7d, 0xa2, 0x22, 0x32,
307 0x87, 0xa2, 0x9e, 0x76, 0x16, 0xc2, 0x01, 0x4c, 0x9a, 0x96, 0x82, 0xd1,
308 0x98, 0xdc, 0xe0, 0xbe, 0x1a, 0xb0, 0x03, 0x1e, 0x2f, 0x44, 0x79, 0xc0,
309 0x59, 0x95, 0x57, 0xa5, 0xc9, 0xcf, 0x55, 0x75, 0x78, 0x1d, 0xe2, 0x43,
310 0x3a, 0x6b, 0x5f, 0xde, 0x5a, 0x32, 0x0f, 0x0e, 0x38, 0x36, 0xe4, 0x74,
311 0x7a, 0x67, 0xd4, 0x88, 0x7e, 0x15, 0x7b, 0x32, 0xf8, 0x57, 0xd4, 0x27,
312 0x38, 0xf4, 0x79, 0xf6, 0x7c, 0x0c, 0x6a, 0x1f, 0xbb, 0x22, 0x15, 0x46,
313 0x4f, 0xec, 0x0b, 0xfc, 0xd8, 0x80, 0x87, 0xf4, 0x4c, 0x80, 0x9f, 0xa5,
314 0x7a, 0xa5, 0x8f, 0x20, 0x22, 0x61, 0x53, 0xbf, 0xa5, 0x11, 0x87, 0x84,
315 0x2b, 0xe3, 0x6d, 0x0d, 0x09, 0x00, 0x5f, 0x5f, 0x7f, 0xb6, 0x3c, 0x0c,
316 0xc3, 0x0f, 0x93, 0xd5, 0x9c, 0xba, 0xb0, 0x7e, 0x4a, 0x37, 0xfa, 0xbf,
317 0xe1, 0x22, 0x00, 0x49, 0xb6, 0x97, 0x08, 0x4e, 0x4e, 0x77, 0xd0, 0x36,
318 0xa9, 0x6e, 0x3b, 0x07, 0x07, 0xe0, 0xab, 0x29, 0x6c, 0xc2, 0x2e, 0xf4,
319 0x8e, 0x61, 0xe0, 0x36, 0x08, 0xd2, 0x01, 0x1a, 0x66, 0x99, 0x30, 0xbc,
320 0xd9, 0x59, 0x41, 0x21, 0x58, 0x6f, 0xc5, 0xa3, 0xf3, 0x76, 0x1a, 0x75,
321 0x60, 0xba, 0x28, 0x32, 0xdd, 0x38, 0x61, 0x45, 0x5d, 0x73, 0xc2, 0x36,
322 0xb2, 0xf8, 0x2a, 0xb0, 0xa2, 0x3c, 0x40, 0x3d, 0x39, 0x7d, 0x1e, 0xe9,
323 0x22, 0xa4, 0x7e, 0xc2, 0xd2, 0x80, 0x09, 0x3a, 0xd8, 0xe5, 0x73, 0x9e,
324 0x46, 0x0b, 0x32, 0x74, 0x6d, 0x11, 0x96, 0xf2, 0x22, 0xc8, 0xd7, 0xbd,
325 0x52, 0x92, 0x28, 0x59, 0x4a, 0xd7, 0x1e, 0x07, 0x2c, 0xc0, 0x13, 0x15,
326 0xb3, 0x33, 0x9a, 0x76, 0xb2, 0x2b, 0x65, 0xe7, 0x4d, 0xc1, 0xf8, 0xa6,
327 0x9c, 0xae, 0x70, 0x05, 0x98, 0x3f, 0xed, 0x56, 0xf2, 0xe2, 0x79, 0x40,
328 0x02, 0x02, 0x03, 0xe7, 0x31, 0x82, 0x02, 0xf1, 0x30, 0x0d, 0x0c, 0x05,
329 0x63, 0x6c, 0x61, 0x73, 0x73, 0x0c, 0x04, 0x67, 0x65, 0x6e, 0x70, 0x30,
330 0x1c, 0x0c, 0x04, 0x68, 0x61, 0x73, 0x68, 0x04, 0x14, 0xdb, 0xdd, 0x56,
331 0xf1, 0xcb, 0x6a, 0xc9, 0x4a, 0xa8, 0x96, 0x8c, 0x91, 0xc1, 0x78, 0x69,
332 0xe1, 0x42, 0x97, 0x32, 0x34, 0x30, 0x82, 0x02, 0xc0, 0x0c, 0x04, 0x64,
333 0x61, 0x74, 0x61, 0x04, 0x82, 0x02, 0xb6, 0x03, 0x00, 0x00, 0x00, 0x06,
334 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x8f, 0xe0, 0xd5, 0xc6, 0x5f,
335 0x89, 0xe9, 0x4c, 0x90, 0xda, 0xe0, 0xe9, 0xee, 0x3a, 0xdd, 0x7d, 0x61,
336 0x54, 0x3e, 0xef, 0xa7, 0xea, 0x3a, 0x97, 0x2a, 0x9b, 0x56, 0x7c, 0x69,
337 0xf9, 0x51, 0x2f, 0x40, 0x36, 0x16, 0xc0, 0xd6, 0x3f, 0xf9, 0x2e, 0xfe,
338 0x44, 0x07, 0x8e, 0xc6, 0x71, 0x70, 0x86, 0x73, 0x52, 0xa8, 0x76, 0x37,
339 0x42, 0x01, 0x93, 0xbe, 0x8c, 0x51, 0xd9, 0x4e, 0x45, 0xe8, 0xf9, 0x7c,
340 0x4f, 0x16, 0x13, 0x80, 0x4d, 0x47, 0xd0, 0x59, 0x4e, 0xeb, 0x40, 0x2a,
341 0x99, 0xa0, 0x7e, 0x77, 0x44, 0xf0, 0x62, 0xb8, 0x26, 0x39, 0x28, 0x18,
342 0x88, 0xdb, 0x37, 0x0c, 0xf1, 0x37, 0x9b, 0x21, 0xbc, 0x50, 0xb7, 0x0f,
343 0x9d, 0xa3, 0xcd, 0x36, 0x5d, 0x7d, 0xc7, 0x14, 0x20, 0x82, 0x66, 0x15,
344 0x63, 0xce, 0x54, 0x04, 0x04, 0xbd, 0x85, 0x2b, 0xcc, 0xba, 0xdd, 0x65,
345 0x7b, 0x8b, 0x6e, 0x0b, 0x8a, 0x51, 0x86, 0xdc, 0xaa, 0x14, 0xef, 0xcd,
346 0x06, 0xaf, 0x7c, 0x28, 0xe3, 0x08, 0xc3, 0xaf, 0x87, 0x14, 0x51, 0x03,
347 0x4c, 0xe8, 0x0f, 0x20, 0xd5, 0x2c, 0x81, 0x11, 0xce, 0x09, 0x26, 0x09,
348 0x8a, 0x51, 0x28, 0x15, 0xef, 0xeb, 0x8c, 0x41, 0xbb, 0xa8, 0x6f, 0x2a,
349 0x4c, 0x2d, 0x63, 0x6a, 0x9e, 0x5a, 0x3d, 0xcb, 0x16, 0x50, 0xc3, 0x4b,
350 0xe5, 0x11, 0x8c, 0x7b, 0x2a, 0x63, 0x04, 0x42, 0xe0, 0x82, 0x76, 0x17,
351 0x47, 0x0f, 0x36, 0x5d, 0x5e, 0x42, 0xa0, 0x86, 0x15, 0xe4, 0x8b, 0x2e,
352 0x63, 0xa0, 0x5e, 0x14, 0x02, 0x73, 0x9b, 0x1c, 0x82, 0x5d, 0x02, 0x9f,
353 0x99, 0x13, 0x59, 0x7b, 0x2a, 0xe8, 0xf6, 0xea, 0xb4, 0x15, 0x0e, 0xe2,
354 0x27, 0x14, 0xdd, 0x45, 0xce, 0x84, 0x24, 0xb6, 0x46, 0x46, 0x48, 0x15,
355 0xb6, 0x85, 0xa8, 0x38, 0xc9, 0x51, 0xe8, 0xae, 0x29, 0xfa, 0xbd, 0x1b,
356 0x9e, 0x04, 0x5b, 0x5f, 0x35, 0x49, 0xc2, 0x12, 0xfb, 0x27, 0xa5, 0xac,
357 0x5b, 0xac, 0x23, 0x00, 0x25, 0xfd, 0x45, 0x85, 0x0a, 0x70, 0x0e, 0xcc,
358 0xa5, 0xc3, 0xce, 0x73, 0xe6, 0xe1, 0xd8, 0xb5, 0x28, 0x9c, 0x9c, 0x79,
359 0x09, 0xc3, 0x40, 0xb5, 0x73, 0x8a, 0x75, 0x4f, 0xd5, 0x35, 0x90, 0xb2,
360 0x2d, 0xdd, 0x5d, 0x89, 0xb9, 0x6d, 0xd8, 0x35, 0x26, 0x81, 0x7d, 0xa3,
361 0xc1, 0x04, 0x95, 0xd1, 0xe4, 0x86, 0x5d, 0x9d, 0xef, 0xa9, 0x5c, 0x42,
362 0x8e, 0x26, 0x18, 0x1e, 0x9a, 0xe4, 0x90, 0x8b, 0xff, 0x98, 0x19, 0x77,
363 0x06, 0xb4, 0x79, 0xda, 0x1e, 0xfa, 0x83, 0xd1, 0x8c, 0x62, 0x1b, 0x17,
364 0xe6, 0xce, 0xbd, 0x28, 0xe1, 0x73, 0x4c, 0x8d, 0xb1, 0x1b, 0x1b, 0xf6,
365 0xa0, 0x7b, 0x98, 0xa7, 0xa2, 0xd3, 0xfd, 0x31, 0x70, 0x40, 0x25, 0x16,
366 0xfa, 0xd7, 0x44, 0x0b, 0x68, 0xba, 0x09, 0xf9, 0x4e, 0xb7, 0xa6, 0xcd,
367 0x9c, 0x0c, 0xd4, 0x98, 0xc4, 0xcc, 0x6b, 0x50, 0xeb, 0x23, 0xc2, 0x5a,
368 0x33, 0xd9, 0x2f, 0x31, 0xfd, 0xba, 0xe5, 0x99, 0x5f, 0xdc, 0x21, 0x7c,
369 0x47, 0x1e, 0x3a, 0xc2, 0x0b, 0xdd, 0xcf, 0xb4, 0x10, 0x15, 0xc4, 0xa0,
370 0xeb, 0x85, 0xb6, 0x5f, 0x94, 0x03, 0x97, 0x67, 0xd8, 0x0d, 0xb7, 0xce,
371 0xe7, 0x16, 0x15, 0x34, 0x92, 0xcf, 0x90, 0x50, 0xc5, 0xeb, 0x63, 0xc8,
372 0xcd, 0xb4, 0x8d, 0xa1, 0x2f, 0xd1, 0x80, 0xcd, 0x36, 0xaa, 0x63, 0xb4,
373 0xae, 0x7b, 0x0d, 0x07, 0x59, 0xc2, 0x54, 0x8f, 0xd7, 0x83, 0xd9, 0xd6,
374 0xb3, 0xd3, 0x7e, 0x66, 0xc8, 0x0c, 0x57, 0x02, 0x6b, 0x4b, 0x8a, 0x74,
375 0x47, 0x96, 0x39, 0x20, 0x0c, 0xad, 0xb8, 0xd1, 0x05, 0x92, 0xfe, 0x0d,
376 0x1d, 0x4a, 0x65, 0x32, 0x53, 0x9b, 0x3d, 0xdb, 0x2d, 0x10, 0xd3, 0x0a,
377 0x42, 0x79, 0xe0, 0x02, 0xc3, 0xe1, 0xec, 0x3d, 0xde, 0x57, 0x8d, 0x03,
378 0x7e, 0x98, 0x62, 0x6c, 0x4a, 0x23, 0xa8, 0x3e, 0xd7, 0x11, 0x03, 0x0b,
379 0x04, 0xae, 0x12, 0xb2, 0xde, 0xb5, 0x2b, 0x6c, 0x99, 0x9f, 0x0a, 0x42,
380 0x20, 0x35, 0x2d, 0x0d, 0xfb, 0x9f, 0xdc, 0xfd, 0x31, 0x14, 0xbd, 0x07,
381 0x94, 0x58, 0x7d, 0xd5, 0x9a, 0x3b, 0xe2, 0xf0, 0xd6, 0x50, 0xff, 0x5e,
382 0x0a, 0xf0, 0xd6, 0x60, 0xb8, 0xa2, 0x71, 0x32, 0x11, 0xb7, 0x10, 0x08,
383 0x70, 0xe7, 0x9d, 0xac, 0x5d, 0x14, 0x6e, 0xa0, 0x7d, 0x27, 0x2c, 0xd0,
384 0xbd, 0xf1, 0x6e, 0x82, 0xdc, 0x6d, 0x57, 0x46, 0xf2, 0xe4, 0x96, 0x43,
385 0x19, 0xc5, 0x9f, 0xe0, 0x8c, 0x6a, 0x0a, 0x55, 0x4a, 0xda, 0x3e, 0xdf,
386 0x9c, 0x3b, 0xf1, 0x3e, 0x13, 0x3b, 0x7e, 0x9e, 0x76, 0xde, 0xeb, 0x3e,
387 0x69, 0xd1, 0xa4, 0x47, 0x54, 0x30, 0xb8, 0x38, 0x15, 0x15, 0x27, 0x49,
388 0x29, 0x93, 0xf0, 0xc6, 0x8a, 0xfa, 0xc0, 0xbb, 0xd4, 0xe3, 0x36, 0xcc,
389 0xb8, 0x5e, 0x1a, 0x05, 0x57, 0xde, 0xa4, 0xbc, 0xbd, 0x21, 0x17, 0xda,
390 0xd4, 0x96, 0x8d, 0x01, 0xa7, 0x79, 0xaa, 0x04, 0x43, 0xaf, 0x6a, 0xd2,
391 0xb4, 0x2d, 0xc6, 0x15, 0x27, 0x02, 0x02, 0x03, 0xe7, 0x04, 0x14, 0x20,
392 0x5a, 0x6b, 0x14, 0x4b, 0x34, 0x12, 0xc6, 0x71, 0x8c, 0xe4, 0xa8, 0x07,
393 0x83, 0x0e, 0xe0, 0x6f, 0x2d, 0xe6, 0x13, 0x02, 0x02, 0x03, 0xe7
394 };
395
396 /* Test backup-restore case, when item had inconsistently set pdmn attribute (due to another bug),
397 and mobile restore restored item with inconsistent attributes and afterwards tried SecItemUpdate()
398 on it, which failed, leading to the failure of the whole restore operation.
399 */
400
401 #if 0
402 static bool SecKeychainWithBackupFile(CFStringRef backupName, CFErrorRef *error, void(^with)(FILE *bufile)) {
403 int fd = SecItemBackupHandoffFD(backupName, error);
404 if (fd < 0)
405 return false;
406 FILE *backup = fdopen(fd, "r");
407 FILE *file = fopen_journal(fname, "w", error);
408
409 if (!backup) {
410 close(fd);
411 return SecCheckErrno(!backup, error, CFSTR("fdopen"));
412 }
413 with(backup);
414 fclose(backup);
415 return true;
416 }
417
418 static void secd_perform_with_data_in_file(const char* test_prefix, void(^with)(CFDataRef backupData))
419 {
420 CFStringRef tmp_dir = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("/tmp/%s.%X/"), test_prefix, arc4random());
421
422 CFStringPerformWithCString(tmp_dir, ^(const char *tmp_dir_string) {
423 errno_t err = mkpath_np(tmp_dir_string, 0755);
424 ok(err == 0 || err == EEXIST, "Create temp dir %s (%d)", tmp_dir_string, err);
425 FILE *file = fopen(fname, "w", error);
426
427 });
428
429 /* set custom keychain dir, reset db */
430 SetCustomHomeURLString(tmp_dir);
431
432 if(do_before_reset)
433 do_before_reset();
434
435 SecKeychainDbReset(NULL);
436
437 CFReleaseNull(tmp_dir);
438 CFReleaseNull(keychain_dir);
439 }
440 #endif
441
442
443 static void tests(void)
444 {
445 /* custom keychain dir */
446 secd_test_setup_temp_keychain("secd_34_backup_der_parse", ^{});
447
448 (void)backup_data;
449
450 #if 0
451 FILE *backup = NULL;
452 CFErrorRef *error = NULL;
453 CFDataRef backupData = CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, backup_data, array_size(backup_data), kCFAllocatorNull);
454
455 CFWriteStreamCreateWithBuffer(kCFAllocatorDefault, <#UInt8 *buffer#>, <#CFIndex bufferCapacity#>)
456 ok(SecKeychainWithBackupFileParse(backup, error, ^(SecBackupEventType et, CFTypeRef key, CFTypeRef item) {
457 diag("This still fails - don't be alarmed");
458 }));
459 CFReleaseSafe(error);
460 #endif
461
462 #if 0
463 ok( SecKeychainWithBackupFileParse
464 (FILE *backup, CFErrorRef *error, void (^handleEvent)(SecBackupEventType et, CFTypeRef key, CFTypeRef item)));
465 fclose(backup);
466 SecItemBackupWithChanges(CFSTR("SecureBackupService"), &error, ^(SecBackupEventType et, CFTypeRef key, CFTypeRef item) {
467 ;
468 });
469
470 CFStreamRef
471 /* Restore keychain from plist. */
472 CFDataRef keybag = CFDataCreate(kCFAllocatorDefault, keybag_data, sizeof(keybag_data));
473 CFDataRef backup = CFDataCreate(kCFAllocatorDefault, (const UInt8 *)export_plist, sizeof(export_plist));
474 ok_status(_SecKeychainRestoreBackup(backup, keybag, NULL));
475 CFRelease(keybag);
476 CFRelease(backup);
477
478 /* The restored item is kind of malformed (pdmn and accc attributes are inconsistent). Currently adopted way
479 of handling of this item is to try to handle it gracefully, this is what this test does (i.e. it checks that
480 it is possible to update such item). Another possibility which might be adopted in the future is dropping such
481 item during backup decoding. In this case, the test should be modified to check that the item does not exist
482 in the keychain at all. */
483
484 /* Try to update item with inconsistent accc and pdmn attributes. */
485 CFDictionaryRef query = CFDictionaryCreateMutableForCFTypesWith(kCFAllocatorDefault,
486 kSecClass, kSecClassGenericPassword,
487 kSecAttrAccessGroup, CFSTR("com.apple.security.sos"),
488 kSecAttrService, CFSTR("test"),
489 NULL);
490 CFDictionaryRef update = CFDictionaryCreateMutableForCFTypesWith(kCFAllocatorDefault,
491 kSecAttrService, CFSTR("updated-test"),
492 NULL);
493
494 ok_status(SecItemUpdate(query, update));
495 diag("This still fails - don't be alarmed");
496 CFRelease(update);
497 CFRelease(query);
498 #endif
499
500 }
501
502 int secd_32_restore_bad_backup(int argc, char *const *argv)
503 {
504 plan_tests(2 + kSecdTestSetupTestCount);
505 tests();
506
507 return 0;
508 }