documented fix
[gnutls.git] / tests / certder.c
blob3a97d74bc6c2f7f261771546c6d530c99de01f61
1 /*
2 * Copyright (C) 2006-2012 Free Software Foundation, Inc.
4 * Author: Simon Josefsson
6 * This file is part of GnuTLS.
8 * GnuTLS is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
13 * GnuTLS is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with GnuTLS; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif
27 #include <gnutls/gnutls.h>
28 #include <gnutls/x509.h>
29 #include "utils.h"
31 void
32 doit (void)
34 int ret;
35 unsigned char der[] = {
36 0x30, 0x82, 0x04, 0x10, 0x30, 0x82, 0x03, 0x79,
37 0xa0, 0x07, 0x02, 0x84, 0x90, 0x00, 0x00, 0x00,
38 0x02, 0x02, 0x01, 0x00, 0x30, 0x0d, 0x06, 0x09,
39 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
40 0x04, 0x05, 0x00, 0x30, 0x81, 0xbb, 0x31, 0x0b,
41 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
42 0x02, 0x2d, 0x2d, 0x31, 0x12, 0x30, 0x10, 0x06,
43 0x03, 0x55, 0x04, 0x08, 0x13, 0x09, 0x53, 0x6f,
44 0x6d, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31,
45 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x07,
46 0x13, 0x08, 0x53, 0x6f, 0x6d, 0x65, 0x43, 0x69,
47 0x74, 0x79, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03,
48 0x55, 0x04, 0x0a, 0x13, 0x10, 0x53, 0x6f, 0x6d,
49 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a,
50 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x31, 0x1f, 0x30,
51 0x1d, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x16,
52 0x53, 0x6f, 0x6d, 0x65, 0x4f, 0x72, 0x67, 0x61,
53 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e,
54 0x61, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x31, 0x1e,
55 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,
56 0x15, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f,
57 0x73, 0x74, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
58 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x31, 0x29,
59 0x30, 0x27, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
60 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, 0x1a, 0x72,
61 0x6f, 0x6f, 0x74, 0x40, 0x6c, 0x6f, 0x63, 0x61,
62 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x2e, 0x6c, 0x6f,
63 0x63, 0x61, 0x6c, 0x64, 0x6f, 0x6d, 0x61, 0x69,
64 0x6e, 0x30, 0x1e, 0x17, 0x0d, 0x30, 0x34, 0x30,
65 0x32, 0x31, 0x38, 0x32, 0x30, 0x30, 0x32, 0x33,
66 0x34, 0x5a, 0x17, 0x0d, 0x30, 0x35, 0x31, 0x31,
67 0x31, 0x37, 0x32, 0x30, 0x30, 0x32, 0x33, 0x34,
68 0x5a, 0x30, 0x81, 0xbb, 0x31, 0x0b, 0x30, 0x09,
69 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x2d,
70 0x2d, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55,
71 0x04, 0x08, 0x13, 0x09, 0x53, 0x6f, 0x6d, 0x65,
72 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x11, 0x30,
73 0x0f, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x08,
74 0x53, 0x6f, 0x6d, 0x65, 0x43, 0x69, 0x74, 0x79,
75 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04,
76 0x0a, 0x13, 0x10, 0x53, 0x6f, 0x6d, 0x65, 0x4f,
77 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74,
78 0x69, 0x6f, 0x6e, 0x31, 0x1f, 0x30, 0x1d, 0x06,
79 0x03, 0x55, 0x04, 0x0b, 0x13, 0x16, 0x53, 0x6f,
80 0x6d, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69,
81 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c,
82 0x55, 0x6e, 0x69, 0x74, 0x31, 0x1e, 0x30, 0x1c,
83 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x15, 0x6c,
84 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74,
85 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x64, 0x6f,
86 0x6d, 0x61, 0x69, 0x6e, 0x31, 0x29, 0x30, 0x27,
87 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
88 0x01, 0x09, 0x01, 0x16, 0x1a, 0x72, 0x6f, 0x6f,
89 0x74, 0x40, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68,
90 0x6f, 0x73, 0x74, 0x2e, 0x6c, 0x6f, 0x63, 0x61,
91 0x6c, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x30,
92 0x81, 0x9f, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86,
93 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05,
94 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, 0x81, 0x89,
95 0x02, 0x81, 0x81, 0x00, 0xda, 0x3d, 0xb7, 0x66,
96 0x9a, 0x41, 0x4f, 0xca, 0x1d, 0xd1, 0xc4, 0x1f,
97 0xc9, 0x4c, 0xc6, 0x76, 0x45, 0xc5, 0x8e, 0x2f,
98 0x3d, 0x45, 0xf5, 0x16, 0x9f, 0xb5, 0x22, 0x0b,
99 0x61, 0x60, 0xa4, 0x42, 0x42, 0x98, 0xae, 0x45,
100 0xe1, 0x4a, 0x17, 0x0b, 0x6e, 0xf7, 0x4e, 0xc0,
101 0x1e, 0xe7, 0x78, 0xd0, 0x80, 0xfc, 0xde, 0x0a,
102 0x96, 0x43, 0x13, 0xe4, 0xb5, 0xef, 0x47, 0xca,
103 0x8f, 0xb3, 0x13, 0x92, 0x10, 0xc4, 0x02, 0x7b,
104 0xbb, 0x6c, 0x9f, 0x2b, 0x63, 0x65, 0xfa, 0xac,
105 0xcb, 0xc9, 0x14, 0x68, 0x53, 0xd9, 0xe2, 0x9c,
106 0x57, 0x52, 0x23, 0xb9, 0x4f, 0x92, 0xc0, 0xa0,
107 0xe3, 0xf5, 0x50, 0xb3, 0xc4, 0x5f, 0x4e, 0x73,
108 0x9d, 0x0e, 0xfd, 0x9c, 0x57, 0x8e, 0x4c, 0x13,
109 0xe0, 0x7a, 0x16, 0x6b, 0x27, 0xc9, 0xac, 0xb3,
110 0x47, 0xb2, 0x3f, 0x8f, 0xe6, 0x1d, 0x00, 0xc8,
111 0xaa, 0x6f, 0xdf, 0xcb, 0x02, 0x03, 0x01, 0x00,
112 0x01, 0xa3, 0x82, 0x01, 0x1c, 0x30, 0x82, 0x01,
113 0x18, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e,
114 0x04, 0x16, 0x04, 0x14, 0xe6, 0x30, 0x79, 0x2b,
115 0xe2, 0xcf, 0x4f, 0xa7, 0x40, 0xa4, 0xb9, 0xa4,
116 0x1e, 0x95, 0x56, 0xe8, 0x94, 0xda, 0xd9, 0x15,
117 0x30, 0x81, 0xe8, 0x06, 0x03, 0x55, 0x1d, 0x23,
118 0x04, 0x81, 0xe0, 0x30, 0x81, 0xdd, 0x80, 0x14,
119 0xe6, 0x30, 0x79, 0x2b, 0xe2, 0xcf, 0x4f, 0xa7,
120 0x40, 0xa4, 0xb9, 0xa4, 0x1e, 0x95, 0x56, 0xe8,
121 0x94, 0xda, 0xd9, 0x15, 0xa1, 0x81, 0xc1, 0xa4,
122 0x81, 0xbe, 0x30, 0x81, 0xbb, 0x31, 0x0b, 0x30,
123 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
124 0x2d, 0x2d, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03,
125 0x55, 0x04, 0x08, 0x13, 0x09, 0x53, 0x6f, 0x6d,
126 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x11,
127 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13,
128 0x08, 0x53, 0x6f, 0x6d, 0x65, 0x43, 0x69, 0x74,
129 0x79, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55,
130 0x04, 0x0a, 0x13, 0x10, 0x53, 0x6f, 0x6d, 0x65,
131 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61,
132 0x74, 0x69, 0x6f, 0x6e, 0x31, 0x1f, 0x30, 0x1d,
133 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x16, 0x53,
134 0x6f, 0x6d, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e,
135 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61,
136 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x31, 0x1e, 0x30,
137 0x1c, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x15,
138 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73,
139 0x74, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x64,
140 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x31, 0x29, 0x30,
141 0x27, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
142 0x0d, 0x01, 0x09, 0x01, 0x16, 0x1a, 0x72, 0x6f,
143 0x6f, 0x74, 0x40, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
144 0x68, 0x6f, 0x73, 0x74, 0x2e, 0x6c, 0x6f, 0x63,
145 0x61, 0x6c, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e,
146 0x82, 0x01, 0x00, 0x30, 0x0c, 0x06, 0x03, 0x55,
147 0x1d, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01,
148 0xff, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48,
149 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x04, 0x05, 0x00,
150 0x03, 0x81, 0x81, 0x00, 0xcd, 0xc9, 0x30, 0x6d,
151 0x02, 0x65, 0x41, 0xea, 0x0e, 0x46, 0x08, 0x6c,
152 0x2f, 0xd5, 0xa7, 0xe4, 0x29, 0xd7, 0x3f, 0x18,
153 0x16, 0xd7, 0x4b, 0x6f, 0x9d, 0xc0, 0x5b, 0xbf,
154 0x68, 0x7b, 0x2e, 0x66, 0xa5, 0x1b, 0xfd, 0xff,
155 0x09, 0x25, 0xa5, 0x56, 0x37, 0x41, 0xd8, 0xaf,
156 0x07, 0xa6, 0x12, 0xa8, 0x58, 0xc4, 0x42, 0x9c,
157 0xce, 0x90, 0x6a, 0x9e, 0x7e, 0x04, 0x27, 0xe3,
158 0xfa, 0x8e, 0xe5, 0xdc, 0xa8, 0x5a, 0xf7, 0xc9,
159 0x0d, 0x23, 0x56, 0x8e, 0x46, 0x84, 0xe8, 0x34,
160 0x83, 0x86, 0xca, 0xc1, 0xcd, 0xfe, 0x68, 0x00,
161 0x67, 0x3f, 0x24, 0x3b, 0x50, 0x63, 0x21, 0x7f,
162 0xba, 0xc6, 0xdb, 0xff, 0xf4, 0x3a, 0x10, 0xb6,
163 0xb5, 0x09, 0x4d, 0x41, 0xff, 0xef, 0xc0, 0x84,
164 0x48, 0x1b, 0x51, 0x87, 0xe6, 0x85, 0xf0, 0x1e,
165 0xbd, 0x99, 0x0d, 0xd3, 0x98, 0xd0, 0xab, 0xd8,
166 0x30, 0x2a, 0xd5, 0x74
169 /* Triggers crash in _asn1_get_objectid_der. */
170 unsigned char der2[] = {
171 0x30, 0x82, 0x04, 0x10, 0x30, 0x82, 0x03, 0x79,
172 0xa0, 0x3, 0x2, 0x1, 0x2, 0x2, 0x1, 0x0, 0x30,
173 0x11, 0x6, 0x84, 0x10, 0x0, 0x0, 0x0, 0x2a,
174 0x86, 0x48, 0x86, 0xf7, 0xd, 0x1, 0x1, 0x4,
175 0x5, 0x0, 0x30, 0x81, 0xbb, 0x31, 0xb, 0x30,
176 0x9, 0x6, 0x3, 0x55, 0x4, 0x6, 0x13, 0x2,
177 0x2d, 0x2d, 0x31, 0x12, 0x30, 0x10, 0x6,
178 0x3, 0x55, 0x4, 0x8, 0x13, 0x9, 0x53,
179 0x6f, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x74,
180 0x65, 0x31, 0x11, 0x30, 0xf, 0x6, 0x3,
181 0x55, 0x4, 0x7, 0x13, 0x8, 0x53, 0x6f,
182 0x6d, 0x65, 0x43, 0x69, 0x74, 0x79,
183 0x31, 0x19, 0x30, 0x17, 0x6, 0x3, 0x55,
184 0x4, 0xa, 0x13, 0x10, 0x53, 0x6f, 0x6d,
185 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69,
186 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x31,
187 0x1f, 0x30, 0x1d, 0x6, 0x3, 0x55, 0x4, 0xb,
188 0x13, 0x16, 0x53, 0x6f, 0x6d, 0x65, 0x4f,
189 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61,
190 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x55,
191 0x6e, 0x69, 0x74, 0x31, 0x1e, 0x30, 0x1c,
192 0x6, 0x3, 0x55, 0x4, 0x3, 0x13, 0x15, 0x6c,
193 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73,
194 0x74, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
195 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x31,
196 0x29, 0x30, 0x27, 0x6, 0x9, 0x2a, 0x86,
197 0x48, 0x86, 0xf7, 0xd, 0x1, 0x9, 0x1, 0x16,
198 0x1a, 0x72
201 /* Triggers crash in asn1_der_decoding. */
202 unsigned char der3[] = {
203 0x30, 0x82, 0x4, 0x10, 0x30, 0x82, 0x3, 0x79,
204 0xa0, 0x3, 0x2, 0x1, 0x2, 0x2, 0x1, 0x0,
205 0x30, 0x11, 0x6, 0x9, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0xd,
206 0x1, 0x1, 0x4, 0x5, 0x84, 0x10, 0x0, 0x0, 0x0, 0x30, 0x81, 0xbb, 0x31,
207 0xb, 0x30, 0x9, 0x6, 0x3, 0x55, 0x4, 0x6, 0x13, 0x2, 0x2d, 0x2d, 0x31,
208 0x12, 0x30, 0x10, 0x6, 0x3, 0x55, 0x4, 0x8, 0x13, 0x9, 0x53, 0x6f, 0x6d,
209 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x11, 0x30, 0xf, 0x6, 0x3,
210 0x55, 0x4, 0x7, 0x13, 0x8, 0x53, 0x6f, 0x6d, 0x65, 0x43, 0x69, 0x74,
211 0x79, 0x31, 0x19, 0x30, 0x17, 0x6, 0x3, 0x55, 0x4, 0xa, 0x13, 0x10,
212 0x53, 0x6f, 0x6d, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61,
213 0x74, 0x69, 0x6f, 0x6e, 0x31, 0x1f, 0x30, 0x1d, 0x6, 0x3, 0x55, 0x4,
214 0xb, 0x13, 0x16, 0x53, 0x6f, 0x6d, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e,
215 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x55, 0x6e, 0x69,
216 0x74, 0x31, 0x1e, 0x30, 0x1c, 0x6, 0x3, 0x55, 0x4, 0x3, 0x13, 0x15,
217 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x2e, 0x6c, 0x6f,
218 0x63, 0x61, 0x6c, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x31, 0x29, 0x30,
219 0x27, 0x6, 0x9, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0xd, 0x1, 0x9, 0x1, 0x16,
220 0x1a, 0x72, 0x6f, 0x6f, 0x74, 0x40, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68,
221 0x6f, 0x73, 0x74, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x64, 0x6f, 0x6d,
222 0x61, 0x69, 0x6e, 0x30, 0x1e, 0x17, 0xd, 0x30, 0x34, 0x30, 0x32, 0x31,
223 0x38, 0x32, 0x30, 0x30, 0x32, 0x33, 0x34, 0x5a, 0x17, 0xd, 0x30, 0x35,
224 0x31, 0x31, 0x31, 0x37, 0x32, 0x30, 0x30, 0x32, 0x33, 0x34, 0x5a, 0x30,
225 0x81, 0xbb, 0x31, 0xb, 0x30, 0x9, 0x6, 0x3, 0x55, 0x4, 0x6, 0x13, 0x2,
226 0x2d, 0x2d, 0x31, 0x12, 0x30, 0x10, 0x6, 0x3, 0x55, 0x4, 0x8, 0x13, 0x9,
227 0x53, 0x6f, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x11, 0x30,
228 0xf, 0x6, 0x3, 0x55, 0x4, 0x7, 0x13, 0x8, 0x53, 0x6f, 0x6d, 0x65, 0x43,
229 0x69, 0x74, 0x79, 0x31, 0x19, 0x30, 0x17, 0x6, 0x3, 0x55, 0x4, 0xa,
230 0x13, 0x10, 0x53, 0x6f, 0x6d, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69,
231 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x31, 0x1f, 0x30, 0x1d, 0x6, 0x3,
232 0x55, 0x4, 0xb, 0x13, 0x16, 0x53, 0x6f, 0x6d, 0x65, 0x4f, 0x72, 0x67,
233 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x55,
234 0x6e, 0x69, 0x74, 0x31, 0x1e, 0x30, 0x1c, 0x6, 0x3, 0x55, 0x4, 0x3,
235 0x13, 0x15, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x2e,
236 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x31,
237 0x29, 0x30, 0x27, 0x6, 0x9, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0xd, 0x1, 0x9,
238 0x1, 0x16, 0x1a, 0x72, 0x6f, 0x6f, 0x74, 0x40, 0x6c, 0x6f, 0x63, 0x61,
239 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x64,
240 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x30, 0x81, 0x9f, 0x30, 0xd, 0x6, 0x9,
241 0x2a, 0x86, 0x48, 0x86, 0xf7, 0xd, 0x1, 0x1, 0x1, 0x5, 0x0, 0x3, 0x81,
242 0x8d, 0x0, 0x30, 0x81, 0x89, 0x2, 0x81, 0x81, 0x0, 0xda, 0x3d, 0xb7,
243 0x66, 0x9a, 0x41, 0x4f, 0xca, 0x1d, 0xd1, 0xc4, 0x1f, 0xc9, 0x4c, 0xc6,
244 0x76, 0x45, 0xc5, 0x8e, 0x2f, 0x3d, 0x45, 0xf5, 0x16, 0x9f, 0xb5, 0x22,
245 0xb, 0x61, 0x60, 0xa4, 0x42, 0x42, 0x98, 0xae, 0x45, 0xe1, 0x4a, 0x17,
246 0xb, 0x6e, 0xf7, 0x4e, 0xc0, 0x1e, 0xe7, 0x78, 0xd0, 0x80, 0xfc, 0xde,
247 0xa, 0x96, 0x43, 0x13, 0xe4, 0xb5, 0xef, 0x47, 0xca, 0x8f, 0xb3, 0x13,
248 0x92, 0x10, 0xc4, 0x2, 0x7b, 0xbb, 0x6c, 0x9f, 0x2b, 0x63, 0x65, 0xfa,
249 0xac, 0xcb, 0xc9, 0x14, 0x68, 0x53, 0xd9, 0xe2, 0x9c, 0x57, 0x52, 0x23,
250 0xb9, 0x4f, 0x92, 0xc0, 0xa0, 0xe3, 0xf5, 0x50, 0xb3, 0xc4, 0x5f, 0x4e,
251 0x73, 0x9d, 0xe, 0xfd, 0x9c, 0x57, 0x8e, 0x4c, 0x13, 0xe0, 0x7a, 0x16,
252 0x6b, 0x27, 0xc9, 0xac, 0xb3, 0x47, 0xb2, 0x3f, 0x8f, 0xe6, 0x1d, 0x0,
253 0xc8, 0xaa, 0x6f, 0xdf, 0xcb, 0x2, 0x3, 0x1, 0x0, 0x1, 0xa3, 0x82, 0x1,
254 0x1c, 0x30, 0x82, 0x1, 0x18, 0x30, 0x1d, 0x6, 0x3, 0x55, 0x1d, 0xe, 0x4,
255 0x16, 0x4, 0x14, 0xe6, 0x30, 0x79, 0x2b, 0xe2, 0xcf, 0x4f, 0xa7, 0x40,
256 0xa4, 0xb9, 0xa4, 0x1e, 0x95, 0x56, 0xe8, 0x94, 0xda, 0xd9, 0x15, 0x30,
257 0x81, 0xe8, 0x6, 0x3, 0x55, 0x1d, 0x23, 0x4, 0x81, 0xe0, 0x30, 0x81,
258 0xdd, 0x80, 0x14, 0xe6, 0x30, 0x79, 0x2b, 0xe2, 0xcf, 0x4f, 0xa7, 0x40,
259 0xa4, 0xb9, 0xa4, 0x1e, 0x95, 0x56, 0xe8, 0x94, 0xda, 0xd9, 0x15, 0xa1,
260 0x81, 0xc1, 0xa4, 0x81, 0xbe, 0x30, 0x81, 0xbb, 0x31, 0xb, 0x30, 0x9,
261 0x6, 0x3, 0x55, 0x4, 0x6, 0x13, 0x2, 0x2d, 0x2d, 0x31, 0x12, 0x30, 0x10,
262 0x6, 0x3, 0x55, 0x4, 0x8, 0x13, 0x9, 0x53, 0x6f, 0x6d, 0x65, 0x53, 0x74,
263 0x61, 0x74, 0x65, 0x31, 0x11, 0x30, 0xf, 0x6, 0x3, 0x55, 0x4, 0x7, 0x13,
264 0x8, 0x53, 0x6f, 0x6d, 0x65, 0x43, 0x69, 0x74, 0x79, 0x31, 0x19, 0x30,
265 0x17, 0x6, 0x3, 0x55, 0x4, 0xa, 0x13, 0x10, 0x53, 0x6f, 0x6d, 0x65,
266 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e,
267 0x31, 0x1f, 0x30, 0x1d, 0x6, 0x3, 0x55, 0x4, 0xb, 0x13, 0x16, 0x53,
268 0x6f, 0x6d, 0x65, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74,
269 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x31, 0x1e, 0x30,
270 0x1c, 0x6, 0x3, 0x55, 0x4, 0x3, 0x13, 0x15, 0x6c, 0x6f, 0x63, 0x61,
271 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x64,
272 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x31, 0x29, 0x30, 0x27, 0x6, 0x9, 0x2a,
273 0x86, 0x48, 0x86, 0xf7, 0xd, 0x1, 0x9, 0x1, 0x16, 0x1a, 0x72, 0x6f,
274 0x6f, 0x74, 0x40, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74,
275 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e,
276 0x82, 0x1, 0x0, 0x30, 0xc, 0x6, 0x3, 0x55, 0x1d, 0x13, 0x4, 0x5, 0x30,
277 0x3, 0x1, 0x1, 0xff, 0x30, 0xd, 0x6, 0x9, 0x2a, 0x86, 0x48, 0x86, 0xf7,
278 0xd, 0x1, 0x1, 0x4, 0x5, 0x0, 0x3, 0x81, 0x81, 0x0, 0xcd, 0xc9, 0x30,
279 0x6d, 0x2, 0x65, 0x41, 0xea, 0xe, 0x46, 0x8, 0x6c, 0x2f, 0xd5, 0xa7,
280 0xe4, 0x29, 0xd7, 0x3f, 0x18, 0x16, 0xd7, 0x4b, 0x6f, 0x9d, 0xc0, 0x5b,
281 0xbf, 0x68, 0x7b, 0x2e, 0x66, 0xa5, 0x1b, 0xfd, 0xff, 0x9, 0x25, 0xa5,
282 0x56, 0x37, 0x41, 0xd8, 0xaf, 0x7, 0xa6, 0x12, 0xa8, 0x58, 0xc4, 0x42,
283 0x9c, 0xce, 0x90, 0x6a, 0x9e, 0x7e, 0x4, 0x27, 0xe3, 0xfa, 0x8e, 0xe5,
284 0xdc, 0xa8, 0x5a, 0xf7, 0xc9, 0xd, 0x23, 0x56, 0x8e, 0x46, 0x84, 0xe8,
285 0x34, 0x83, 0x86, 0xca, 0xc1, 0xcd, 0xfe, 0x68, 0x0, 0x67, 0x3f, 0x24,
286 0x3b, 0x50, 0x63, 0x21, 0x7f, 0xba, 0xc6, 0xdb, 0xff, 0xf4, 0x3a, 0x10,
287 0xb6, 0xb5, 0x9, 0x4d, 0x41, 0xff, 0xef, 0xc0, 0x84, 0x48, 0x1b, 0x51,
288 0x87, 0xe6, 0x85, 0xf0, 0x1e, 0xbd, 0x99, 0xd, 0xd3, 0x98, 0xd0, 0xab,
289 0xd8, 0x30, 0x2a, 0xd5, 0x74
291 gnutls_datum_t derCert = { der, sizeof (der) };
292 gnutls_datum_t der2Cert = { der2, sizeof (der2) };
293 gnutls_datum_t der3Cert = { der3, sizeof (der3) };
294 gnutls_x509_crt_t cert;
296 ret = gnutls_global_init ();
297 if (ret < 0)
298 fail ("init %d\n", ret);
300 ret = gnutls_x509_crt_init (&cert);
301 if (ret < 0)
302 fail ("crt_init %d\n", ret);
304 ret = gnutls_x509_crt_import (cert, &derCert, GNUTLS_X509_FMT_DER);
305 if (ret != GNUTLS_E_ASN1_DER_ERROR)
306 fail ("crt_import %d\n", ret);
308 gnutls_x509_crt_deinit (cert);
310 ret = gnutls_x509_crt_init (&cert);
311 if (ret < 0)
312 fail ("crt_init %d\n", ret);
314 ret = gnutls_x509_crt_import (cert, &der2Cert, GNUTLS_X509_FMT_DER);
315 if (ret != GNUTLS_E_ASN1_DER_ERROR)
316 fail ("crt2_import %d\n", ret);
318 gnutls_x509_crt_deinit (cert);
320 ret = gnutls_x509_crt_init (&cert);
321 if (ret < 0)
322 fail ("crt_init %d\n", ret);
324 ret = gnutls_x509_crt_import (cert, &der3Cert, GNUTLS_X509_FMT_DER);
325 if (ret != GNUTLS_E_ASN1_DER_ERROR)
326 fail ("crt3_import %d\n", ret);
328 if (debug)
329 success ("done\n");
331 gnutls_x509_crt_deinit (cert);
333 gnutls_global_deinit ();