diff options
author | Christian Grothoff <christian@grothoff.org> | 2008-11-16 01:21:08 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2008-11-16 01:21:08 +0000 |
commit | a61b09be334f7fafefa5ce067bb2d0b8e44f9ec7 (patch) | |
tree | 7f1a7c177126d380d143b747c1fd38c24b339024 | |
parent | 671f9efa2d6a62277312a345c53ebeace8cfc3d1 (diff) | |
download | libmicrohttpd-a61b09be334f7fafefa5ce067bb2d0b8e44f9ec7.tar.gz libmicrohttpd-a61b09be334f7fafefa5ce067bb2d0b8e44f9ec7.zip |
dce
-rw-r--r-- | src/daemon/https/x509/extensions.c | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/src/daemon/https/x509/extensions.c b/src/daemon/https/x509/extensions.c index 3b8bf494..1835f2ae 100644 --- a/src/daemon/https/x509/extensions.c +++ b/src/daemon/https/x509/extensions.c | |||
@@ -171,97 +171,6 @@ MHD__gnutls_x509_crt_get_extension (MHD_gnutls_x509_crt_t cert, | |||
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | /* This function will attempt to return the requested extension OID found in | ||
175 | * the given X509v3 certificate. | ||
176 | * | ||
177 | * If you have passed the last extension, GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will | ||
178 | * be returned. | ||
179 | */ | ||
180 | int | ||
181 | MHD__gnutls_x509_crt_get_extension_oid (MHD_gnutls_x509_crt_t cert, | ||
182 | int indx, void *oid, | ||
183 | size_t * sizeof_oid) | ||
184 | { | ||
185 | int k, result, len; | ||
186 | char name[MAX_NAME_SIZE], name2[MAX_NAME_SIZE]; | ||
187 | char str[1024]; | ||
188 | char extnID[128]; | ||
189 | int indx_counter = 0; | ||
190 | |||
191 | k = 0; | ||
192 | do | ||
193 | { | ||
194 | k++; | ||
195 | |||
196 | snprintf (name, sizeof (name), "tbsCertificate.extensions.?%u", k); | ||
197 | |||
198 | len = sizeof (str) - 1; | ||
199 | result = MHD__asn1_read_value (cert->cert, name, str, &len); | ||
200 | |||
201 | /* move to next | ||
202 | */ | ||
203 | |||
204 | if (result == ASN1_ELEMENT_NOT_FOUND) | ||
205 | { | ||
206 | break; | ||
207 | } | ||
208 | |||
209 | do | ||
210 | { | ||
211 | |||
212 | MHD_gtls_str_cpy (name2, sizeof (name2), name); | ||
213 | MHD_gtls_str_cat (name2, sizeof (name2), ".extnID"); | ||
214 | |||
215 | len = sizeof (extnID) - 1; | ||
216 | result = MHD__asn1_read_value (cert->cert, name2, extnID, &len); | ||
217 | |||
218 | if (result == ASN1_ELEMENT_NOT_FOUND) | ||
219 | { | ||
220 | MHD_gnutls_assert (); | ||
221 | break; | ||
222 | } | ||
223 | else if (result != ASN1_SUCCESS) | ||
224 | { | ||
225 | MHD_gnutls_assert (); | ||
226 | return MHD_gtls_asn2err (result); | ||
227 | } | ||
228 | |||
229 | /* Handle Extension | ||
230 | */ | ||
231 | if (indx == indx_counter++) | ||
232 | { | ||
233 | len = strlen (extnID) + 1; | ||
234 | |||
235 | if (*sizeof_oid < (unsigned) len) | ||
236 | { | ||
237 | *sizeof_oid = len; | ||
238 | MHD_gnutls_assert (); | ||
239 | return GNUTLS_E_SHORT_MEMORY_BUFFER; | ||
240 | } | ||
241 | |||
242 | memcpy (oid, extnID, len); | ||
243 | *sizeof_oid = len - 1; | ||
244 | |||
245 | return 0; | ||
246 | } | ||
247 | |||
248 | |||
249 | } | ||
250 | while (0); | ||
251 | } | ||
252 | while (1); | ||
253 | |||
254 | if (result == ASN1_ELEMENT_NOT_FOUND) | ||
255 | { | ||
256 | return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE; | ||
257 | } | ||
258 | else | ||
259 | { | ||
260 | MHD_gnutls_assert (); | ||
261 | return MHD_gtls_asn2err (result); | ||
262 | } | ||
263 | } | ||
264 | |||
265 | /* Here we only extract the KeyUsage field, from the DER encoded | 174 | /* Here we only extract the KeyUsage field, from the DER encoded |
266 | * extension. | 175 | * extension. |
267 | */ | 176 | */ |