OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/base/x509_cert_types.h" | 5 #include "net/base/x509_cert_types.h" |
6 | 6 |
7 #include <CoreServices/CoreServices.h> | 7 #include <CoreServices/CoreServices.h> |
8 #include <Security/Security.h> | 8 #include <Security/Security.h> |
9 #include <Security/SecAsn1Coder.h> | 9 #include <Security/SecAsn1Coder.h> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 // The following structs and templates work with Apple's very arcane and under- | 30 // The following structs and templates work with Apple's very arcane and under- |
31 // documented SecAsn1Parser API, which is apparently the same as NSS's ASN.1 | 31 // documented SecAsn1Parser API, which is apparently the same as NSS's ASN.1 |
32 // decoder: | 32 // decoder: |
33 // http://www.mozilla.org/projects/security/pki/nss/tech-notes/tn1.html | 33 // http://www.mozilla.org/projects/security/pki/nss/tech-notes/tn1.html |
34 | 34 |
35 // These are used to parse the contents of a raw | 35 // These are used to parse the contents of a raw |
36 // BER DistinguishedName structure. | 36 // BER DistinguishedName structure. |
37 | 37 |
38 struct KeyValuePair { | 38 struct KeyValuePair { |
39 CSSM_OID key; | 39 enum ValueType { |
40 int value_type; | |
41 CSSM_DATA value; | |
42 | |
43 enum { | |
44 kTypeOther = 0, | 40 kTypeOther = 0, |
45 kTypePrintableString, | 41 kTypePrintableString, |
46 kTypeIA5String, | 42 kTypeIA5String, |
47 kTypeT61String, | 43 kTypeT61String, |
48 kTypeUTF8String, | 44 kTypeUTF8String, |
49 kTypeBMPString, | 45 kTypeBMPString, |
50 kTypeUniversalString, | 46 kTypeUniversalString, |
51 }; | 47 }; |
| 48 |
| 49 CSSM_OID key; |
| 50 ValueType value_type; |
| 51 CSSM_DATA value; |
52 }; | 52 }; |
53 | 53 |
54 const SecAsn1Template kStringValueTemplate[] = { | 54 const SecAsn1Template kStringValueTemplate[] = { |
55 { SEC_ASN1_CHOICE, offsetof(KeyValuePair, value_type), }, | 55 { SEC_ASN1_CHOICE, offsetof(KeyValuePair, value_type), }, |
56 { SEC_ASN1_PRINTABLE_STRING, | 56 { SEC_ASN1_PRINTABLE_STRING, |
57 offsetof(KeyValuePair, value), 0, KeyValuePair::kTypePrintableString }, | 57 offsetof(KeyValuePair, value), 0, KeyValuePair::kTypePrintableString }, |
58 { SEC_ASN1_IA5_STRING, | 58 { SEC_ASN1_IA5_STRING, |
59 offsetof(KeyValuePair, value), 0, KeyValuePair::kTypeIA5String }, | 59 offsetof(KeyValuePair, value), 0, KeyValuePair::kTypeIA5String }, |
60 { SEC_ASN1_T61_STRING, | 60 { SEC_ASN1_T61_STRING, |
61 offsetof(KeyValuePair, value), 0, KeyValuePair::kTypeT61String }, | 61 offsetof(KeyValuePair, value), 0, KeyValuePair::kTypeT61String }, |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 match(locality_name, against.locality_name) && | 302 match(locality_name, against.locality_name) && |
303 match(state_or_province_name, against.state_or_province_name) && | 303 match(state_or_province_name, against.state_or_province_name) && |
304 match(country_name, against.country_name) && | 304 match(country_name, against.country_name) && |
305 match(street_addresses, against.street_addresses) && | 305 match(street_addresses, against.street_addresses) && |
306 match(organization_names, against.organization_names) && | 306 match(organization_names, against.organization_names) && |
307 match(organization_unit_names, against.organization_unit_names) && | 307 match(organization_unit_names, against.organization_unit_names) && |
308 match(domain_components, against.domain_components); | 308 match(domain_components, against.domain_components); |
309 } | 309 } |
310 | 310 |
311 } // namespace net | 311 } // namespace net |
OLD | NEW |