OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | 4 |
5 /* | 5 /* |
6 * Code for dealing with X509.V3 extensions. | 6 * Code for dealing with X509.V3 extensions. |
7 */ | 7 */ |
8 | 8 |
9 #include "cert.h" | 9 #include "cert.h" |
10 #include "secitem.h" | 10 #include "secitem.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 * apply the base URL string if it exists | 65 * apply the base URL string if it exists |
66 */ | 66 */ |
67 char * | 67 char * |
68 CERT_FindCertURLExtension(CERTCertificate *cert, int tag, int catag) | 68 CERT_FindCertURLExtension(CERTCertificate *cert, int tag, int catag) |
69 { | 69 { |
70 SECStatus rv; | 70 SECStatus rv; |
71 SECItem urlitem = {siBuffer,0}; | 71 SECItem urlitem = {siBuffer,0}; |
72 SECItem baseitem = {siBuffer,0}; | 72 SECItem baseitem = {siBuffer,0}; |
73 SECItem urlstringitem = {siBuffer,0}; | 73 SECItem urlstringitem = {siBuffer,0}; |
74 SECItem basestringitem = {siBuffer,0}; | 74 SECItem basestringitem = {siBuffer,0}; |
75 PRArenaPool *arena = NULL; | 75 PLArenaPool *arena = NULL; |
76 PRBool hasbase; | 76 PRBool hasbase; |
77 char *urlstring; | 77 char *urlstring; |
78 char *str; | 78 char *str; |
79 int len; | 79 int len; |
80 unsigned int i; | 80 unsigned int i; |
81 | 81 |
82 urlstring = NULL; | 82 urlstring = NULL; |
83 | 83 |
84 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); | 84 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); |
85 if ( ! arena ) { | 85 if ( ! arena ) { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 192 |
193 | 193 |
194 /* | 194 /* |
195 * get the value of a string type extension | 195 * get the value of a string type extension |
196 */ | 196 */ |
197 char * | 197 char * |
198 CERT_FindNSStringExtension(CERTCertificate *cert, int oidtag) | 198 CERT_FindNSStringExtension(CERTCertificate *cert, int oidtag) |
199 { | 199 { |
200 SECItem wrapperItem, tmpItem = {siBuffer,0}; | 200 SECItem wrapperItem, tmpItem = {siBuffer,0}; |
201 SECStatus rv; | 201 SECStatus rv; |
202 PRArenaPool *arena = NULL; | 202 PLArenaPool *arena = NULL; |
203 char *retstring = NULL; | 203 char *retstring = NULL; |
204 | 204 |
205 wrapperItem.data = NULL; | 205 wrapperItem.data = NULL; |
206 tmpItem.data = NULL; | 206 tmpItem.data = NULL; |
207 | 207 |
208 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); | 208 arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); |
209 | 209 |
210 if ( ! arena ) { | 210 if ( ! arena ) { |
211 goto loser; | 211 goto loser; |
212 } | 212 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 rv = CERT_DecodeBasicConstraintValue (value, &encodedExtenValue); | 305 rv = CERT_DecodeBasicConstraintValue (value, &encodedExtenValue); |
306 | 306 |
307 /* free the raw extension data */ | 307 /* free the raw extension data */ |
308 PORT_Free(encodedExtenValue.data); | 308 PORT_Free(encodedExtenValue.data); |
309 encodedExtenValue.data = NULL; | 309 encodedExtenValue.data = NULL; |
310 | 310 |
311 return(rv); | 311 return(rv); |
312 } | 312 } |
313 | 313 |
314 CERTAuthKeyID * | 314 CERTAuthKeyID * |
315 CERT_FindAuthKeyIDExten (PRArenaPool *arena, CERTCertificate *cert) | 315 CERT_FindAuthKeyIDExten (PLArenaPool *arena, CERTCertificate *cert) |
316 { | 316 { |
317 SECItem encodedExtenValue; | 317 SECItem encodedExtenValue; |
318 SECStatus rv; | 318 SECStatus rv; |
319 CERTAuthKeyID *ret; | 319 CERTAuthKeyID *ret; |
320 | 320 |
321 encodedExtenValue.data = NULL; | 321 encodedExtenValue.data = NULL; |
322 encodedExtenValue.len = 0; | 322 encodedExtenValue.len = 0; |
323 | 323 |
324 rv = cert_FindExtension(cert->extensions, SEC_OID_X509_AUTH_KEY_ID, | 324 rv = cert_FindExtension(cert->extensions, SEC_OID_X509_AUTH_KEY_ID, |
325 &encodedExtenValue); | 325 &encodedExtenValue); |
(...skipping 30 matching lines...) Expand all Loading... |
356 if (rv == SECFailure) { | 356 if (rv == SECFailure) { |
357 rv = (PORT_GetError () == SEC_ERROR_EXTENSION_NOT_FOUND) ? | 357 rv = (PORT_GetError () == SEC_ERROR_EXTENSION_NOT_FOUND) ? |
358 SECSuccess : SECFailure; | 358 SECSuccess : SECFailure; |
359 } else if (!(keyUsage.data[0] & usage)) { | 359 } else if (!(keyUsage.data[0] & usage)) { |
360 PORT_SetError (SEC_ERROR_CERT_USAGES_INVALID); | 360 PORT_SetError (SEC_ERROR_CERT_USAGES_INVALID); |
361 rv = SECFailure; | 361 rv = SECFailure; |
362 } | 362 } |
363 PORT_Free (keyUsage.data); | 363 PORT_Free (keyUsage.data); |
364 return (rv); | 364 return (rv); |
365 } | 365 } |
OLD | NEW |