OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 // SHA-1 fingerprint (160 bits) of a certificate. | 31 // SHA-1 fingerprint (160 bits) of a certificate. |
32 struct NET_EXPORT SHA1Fingerprint { | 32 struct NET_EXPORT 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 unsigned char data[20]; | 37 unsigned char data[20]; |
38 }; | 38 }; |
39 | 39 |
| 40 // In the future there will be a generic Fingerprint type, with at least two |
| 41 // implementations: SHA1 and SHA256. See http://crbug.com/117914. Until that |
| 42 // work is done (in a separate patch) this typedef bridges the gap. |
| 43 typedef SHA1Fingerprint Fingerprint; |
| 44 |
| 45 typedef std::vector<Fingerprint> FingerprintVector; |
| 46 |
40 class NET_EXPORT SHA1FingerprintLessThan { | 47 class NET_EXPORT SHA1FingerprintLessThan { |
41 public: | 48 public: |
42 bool operator() (const SHA1Fingerprint& lhs, | 49 bool operator() (const SHA1Fingerprint& lhs, |
43 const SHA1Fingerprint& rhs) const { | 50 const SHA1Fingerprint& rhs) const { |
44 return memcmp(lhs.data, rhs.data, sizeof(lhs.data)) < 0; | 51 return memcmp(lhs.data, rhs.data, sizeof(lhs.data)) < 0; |
45 } | 52 } |
46 }; | 53 }; |
47 | 54 |
48 // IsSHA1HashInSortedArray returns true iff |hash| is in |array|, a sorted | 55 // IsSHA1HashInSortedArray returns true iff |hash| is in |array|, a sorted |
49 // array of SHA1 hashes. | 56 // array of SHA1 hashes. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // Attempts to parse |raw_date|, an ASN.1 date/time string encoded as | 158 // Attempts to parse |raw_date|, an ASN.1 date/time string encoded as |
152 // |format|, and writes the result into |*time|. If an invalid date is | 159 // |format|, and writes the result into |*time|. If an invalid date is |
153 // specified, or if parsing fails, returns false, and |*time| will not be | 160 // specified, or if parsing fails, returns false, and |*time| will not be |
154 // updated. | 161 // updated. |
155 bool ParseCertificateDate(const base::StringPiece& raw_date, | 162 bool ParseCertificateDate(const base::StringPiece& raw_date, |
156 CertDateFormat format, | 163 CertDateFormat format, |
157 base::Time* time); | 164 base::Time* time); |
158 } // namespace net | 165 } // namespace net |
159 | 166 |
160 #endif // NET_BASE_X509_CERT_TYPES_H_ | 167 #endif // NET_BASE_X509_CERT_TYPES_H_ |
OLD | NEW |