Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(540)

Side by Side Diff: net/base/x509_cert_types.h

Issue 6793026: Initial support for HSTS certificate locking. This isn't a finished work, but (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 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
11 #include <set> 11 #include <set>
(...skipping 14 matching lines...) Expand all
26 namespace net { 26 namespace net {
27 27
28 class X509Certificate; 28 class X509Certificate;
29 29
30 // SHA-1 fingerprint (160 bits) of a certificate. 30 // SHA-1 fingerprint (160 bits) of a certificate.
31 struct SHA1Fingerprint { 31 struct SHA1Fingerprint {
32 bool Equals(const SHA1Fingerprint& other) const { 32 bool Equals(const SHA1Fingerprint& other) const {
33 return memcmp(data, other.data, sizeof(data)) == 0; 33 return memcmp(data, other.data, sizeof(data)) == 0;
34 } 34 }
35 35
36 // Returns the fingerprint as a lower-case hex string, e.g. a14bcd12.....
37 std::string GetString() const;
38
36 unsigned char data[20]; 39 unsigned char data[20];
37 }; 40 };
38 41
39 class SHA1FingerprintLessThan { 42 class SHA1FingerprintLessThan {
40 public: 43 public:
41 bool operator() (const SHA1Fingerprint& lhs, 44 bool operator() (const SHA1Fingerprint& lhs,
42 const SHA1Fingerprint& rhs) const { 45 const SHA1Fingerprint& rhs) const {
43 return memcmp(lhs.data, rhs.data, sizeof(lhs.data)) < 0; 46 return memcmp(lhs.data, rhs.data, sizeof(lhs.data)) < 0;
44 } 47 }
45 }; 48 };
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // Attempts to parse |raw_date|, an ASN.1 date/time string encoded as 148 // Attempts to parse |raw_date|, an ASN.1 date/time string encoded as
146 // |format|, and writes the result into |*time|. If an invalid date is 149 // |format|, and writes the result into |*time|. If an invalid date is
147 // specified, or if parsing fails, returns false, and |*time| will not be 150 // specified, or if parsing fails, returns false, and |*time| will not be
148 // updated. 151 // updated.
149 bool ParseCertificateDate(const base::StringPiece& raw_date, 152 bool ParseCertificateDate(const base::StringPiece& raw_date,
150 CertDateFormat format, 153 CertDateFormat format,
151 base::Time* time); 154 base::Time* time);
152 } // namespace net 155 } // namespace net
153 156
154 #endif // NET_BASE_X509_CERT_TYPES_H_ 157 #endif // NET_BASE_X509_CERT_TYPES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698