| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CERT_TYPES_H_ | 5 #ifndef NET_BASE_X509_CERT_TYPES_H_ |
| 6 #define NET_BASE_X509_CERT_TYPES_H_ | 6 #define NET_BASE_X509_CERT_TYPES_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 namespace net { | 27 namespace net { |
| 28 | 28 |
| 29 class X509Certificate; | 29 class X509Certificate; |
| 30 | 30 |
| 31 // SHA-1 fingerprint (160 bits) of a certificate. | 31 // SHA-1 fingerprint (160 bits) of a certificate. |
| 32 struct SHA1Fingerprint { | 32 struct SHA1Fingerprint { |
| 33 bool Equals(const SHA1Fingerprint& other) const { | 33 bool Equals(const SHA1Fingerprint& other) const { |
| 34 return memcmp(data, other.data, sizeof(data)) == 0; | 34 return memcmp(data, other.data, sizeof(data)) == 0; |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool operator==(const SHA1Fingerprint& other) const { |
| 38 return Equals(other); |
| 39 } |
| 40 |
| 37 unsigned char data[20]; | 41 unsigned char data[20]; |
| 38 }; | 42 }; |
| 39 | 43 |
| 40 class SHA1FingerprintLessThan { | 44 class SHA1FingerprintLessThan { |
| 41 public: | 45 public: |
| 42 bool operator() (const SHA1Fingerprint& lhs, | 46 bool operator() (const SHA1Fingerprint& lhs, |
| 43 const SHA1Fingerprint& rhs) const { | 47 const SHA1Fingerprint& rhs) const { |
| 44 return memcmp(lhs.data, rhs.data, sizeof(lhs.data)) < 0; | 48 return memcmp(lhs.data, rhs.data, sizeof(lhs.data)) < 0; |
| 45 } | 49 } |
| 46 }; | 50 }; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // Attempts to parse |raw_date|, an ASN.1 date/time string encoded as | 150 // Attempts to parse |raw_date|, an ASN.1 date/time string encoded as |
| 147 // |format|, and writes the result into |*time|. If an invalid date is | 151 // |format|, and writes the result into |*time|. If an invalid date is |
| 148 // specified, or if parsing fails, returns false, and |*time| will not be | 152 // specified, or if parsing fails, returns false, and |*time| will not be |
| 149 // updated. | 153 // updated. |
| 150 bool ParseCertificateDate(const base::StringPiece& raw_date, | 154 bool ParseCertificateDate(const base::StringPiece& raw_date, |
| 151 CertDateFormat format, | 155 CertDateFormat format, |
| 152 base::Time* time); | 156 base::Time* time); |
| 153 } // namespace net | 157 } // namespace net |
| 154 | 158 |
| 155 #endif // NET_BASE_X509_CERT_TYPES_H_ | 159 #endif // NET_BASE_X509_CERT_TYPES_H_ |
| OLD | NEW |