OLD | NEW |
1 // Copyright (c) 2007-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2007-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 #ifndef NET_BASE_X509_TYPES_H_ | 5 #ifndef NET_BASE_X509_CERT_TYPES_H_ |
6 #define NET_BASE_X509_TYPES_H_ | 6 #define NET_BASE_X509_CERT_TYPES_H_ |
7 | 7 |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
| 10 #include <functional> |
10 #include <iostream> | 11 #include <iostream> |
11 #include <map> | 12 #include <map> |
12 #include <set> | 13 #include <set> |
13 #include <string> | 14 #include <string> |
14 #include <vector> | 15 #include <vector> |
15 | 16 |
16 #include "base/ref_counted.h" | 17 #include "base/ref_counted.h" |
17 #include "base/singleton.h" | 18 #include "base/singleton.h" |
18 #include "base/time.h" | 19 #include "base/time.h" |
19 #include "testing/gtest/include/gtest/gtest_prod.h" | 20 #include "testing/gtest/include/gtest/gtest_prod.h" |
(...skipping 17 matching lines...) Expand all Loading... |
37 bool Equals(const SHA1Fingerprint& other) const { | 38 bool Equals(const SHA1Fingerprint& other) const { |
38 return memcmp(data, other.data, sizeof(data)) == 0; | 39 return memcmp(data, other.data, sizeof(data)) == 0; |
39 } | 40 } |
40 | 41 |
41 unsigned char data[20]; | 42 unsigned char data[20]; |
42 }; | 43 }; |
43 | 44 |
44 class SHA1FingerprintLessThan | 45 class SHA1FingerprintLessThan |
45 : public std::binary_function<SHA1Fingerprint, SHA1Fingerprint, bool> { | 46 : public std::binary_function<SHA1Fingerprint, SHA1Fingerprint, bool> { |
46 public: | 47 public: |
47 bool operator() (const SHA1Fingerprint& lhs, const SHA1Fingerprint& rhs) const
; | 48 bool operator() (const SHA1Fingerprint& lhs, |
| 49 const SHA1Fingerprint& rhs) const { |
| 50 return memcmp(lhs.data, rhs.data, sizeof(lhs.data)) < 0; |
| 51 } |
48 }; | 52 }; |
49 | 53 |
50 // CertPrincipal represents the issuer or subject field of an X.509 certificate. | 54 // CertPrincipal represents the issuer or subject field of an X.509 certificate. |
51 struct CertPrincipal { | 55 struct CertPrincipal { |
52 CertPrincipal() { } | 56 CertPrincipal() { } |
53 explicit CertPrincipal(const std::string& name) : common_name(name) { } | 57 explicit CertPrincipal(const std::string& name) : common_name(name) { } |
54 | 58 |
55 // Parses a BER-format DistinguishedName. | 59 // Parses a BER-format DistinguishedName. |
56 bool ParseDistinguishedName(const void* ber_name_data, size_t length); | 60 bool ParseDistinguishedName(const void* ber_name_data, size_t length); |
57 | 61 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 #if defined(OS_MACOSX) | 127 #if defined(OS_MACOSX) |
124 // Compares two OIDs by value. | 128 // Compares two OIDs by value. |
125 inline bool CSSMOIDEqual(const CSSM_OID* oid1, const CSSM_OID* oid2) { | 129 inline bool CSSMOIDEqual(const CSSM_OID* oid1, const CSSM_OID* oid2) { |
126 return oid1->Length == oid2->Length && | 130 return oid1->Length == oid2->Length && |
127 (memcmp(oid1->Data, oid2->Data, oid1->Length) == 0); | 131 (memcmp(oid1->Data, oid2->Data, oid1->Length) == 0); |
128 } | 132 } |
129 #endif | 133 #endif |
130 | 134 |
131 } // namespace net | 135 } // namespace net |
132 | 136 |
133 #endif // NET_BASE_X509_TYPES_H_ | 137 #endif // NET_BASE_X509_CERT_TYPES_H_ |
OLD | NEW |