OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_CERTIFICATE_H_ | 5 #ifndef NET_BASE_X509_CERTIFICATE_H_ |
6 #define NET_BASE_X509_CERTIFICATE_H_ | 6 #define NET_BASE_X509_CERTIFICATE_H_ |
7 | 7 |
| 8 #include <string.h> |
| 9 |
8 #include <map> | 10 #include <map> |
9 #include <set> | 11 #include <set> |
10 #include <string> | 12 #include <string> |
11 #include <vector> | 13 #include <vector> |
12 | 14 |
13 #include "base/ref_counted.h" | 15 #include "base/ref_counted.h" |
14 #include "base/singleton.h" | 16 #include "base/singleton.h" |
15 #include "base/time.h" | 17 #include "base/time.h" |
16 #include "testing/gtest/include/gtest/gtest_prod.h" | 18 #include "testing/gtest/include/gtest/gtest_prod.h" |
17 | 19 |
(...skipping 11 matching lines...) Expand all Loading... |
29 | 31 |
30 namespace net { | 32 namespace net { |
31 | 33 |
32 class CertVerifyResult; | 34 class CertVerifyResult; |
33 | 35 |
34 // X509Certificate represents an X.509 certificate used by SSL. | 36 // X509Certificate represents an X.509 certificate used by SSL. |
35 class X509Certificate : public base::RefCountedThreadSafe<X509Certificate> { | 37 class X509Certificate : public base::RefCountedThreadSafe<X509Certificate> { |
36 public: | 38 public: |
37 // SHA-1 fingerprint (160 bits) of a certificate. | 39 // SHA-1 fingerprint (160 bits) of a certificate. |
38 struct Fingerprint { | 40 struct Fingerprint { |
| 41 bool operator==(const Fingerprint& other) const { |
| 42 return memcmp(data, other.data, sizeof(data)) == 0; |
| 43 } |
| 44 |
39 unsigned char data[20]; | 45 unsigned char data[20]; |
40 }; | 46 }; |
41 | 47 |
42 class FingerprintLessThan | 48 class FingerprintLessThan |
43 : public std::binary_function<Fingerprint, Fingerprint, bool> { | 49 : public std::binary_function<Fingerprint, Fingerprint, bool> { |
44 public: | 50 public: |
45 bool operator() (const Fingerprint& lhs, const Fingerprint& rhs) const; | 51 bool operator() (const Fingerprint& lhs, const Fingerprint& rhs) const; |
46 }; | 52 }; |
47 | 53 |
48 // Predicate functor used in maps when X509Certificate is used as the key. | 54 // Predicate functor used in maps when X509Certificate is used as the key. |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 296 |
291 // Where the certificate comes from. | 297 // Where the certificate comes from. |
292 Source source_; | 298 Source source_; |
293 | 299 |
294 DISALLOW_COPY_AND_ASSIGN(X509Certificate); | 300 DISALLOW_COPY_AND_ASSIGN(X509Certificate); |
295 }; | 301 }; |
296 | 302 |
297 } // namespace net | 303 } // namespace net |
298 | 304 |
299 #endif // NET_BASE_X509_CERTIFICATE_H_ | 305 #endif // NET_BASE_X509_CERTIFICATE_H_ |
OLD | NEW |