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_CERT_X509_CERTIFICATE_H_ | 5 #ifndef NET_CERT_X509_CERTIFICATE_H_ |
6 #define NET_CERT_X509_CERTIFICATE_H_ | 6 #define NET_CERT_X509_CERTIFICATE_H_ |
7 | 7 |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // certificate is invalid before the |valid_start| date and invalid after | 210 // certificate is invalid before the |valid_start| date and invalid after |
211 // the |valid_expiry| date. | 211 // the |valid_expiry| date. |
212 // If we were unable to parse either date from the certificate (or if the cert | 212 // If we were unable to parse either date from the certificate (or if the cert |
213 // lacks either date), the date will be null (i.e., is_null() will be true). | 213 // lacks either date), the date will be null (i.e., is_null() will be true). |
214 const base::Time& valid_start() const { return valid_start_; } | 214 const base::Time& valid_start() const { return valid_start_; } |
215 const base::Time& valid_expiry() const { return valid_expiry_; } | 215 const base::Time& valid_expiry() const { return valid_expiry_; } |
216 | 216 |
217 // The fingerprint of this certificate. | 217 // The fingerprint of this certificate. |
218 const SHA1HashValue& fingerprint() const { return fingerprint_; } | 218 const SHA1HashValue& fingerprint() const { return fingerprint_; } |
219 | 219 |
| 220 // The SHA-256 fingerprint of this certificate. |
| 221 const SHA256HashValue fingerprint256() const { |
| 222 net::X509Certificate::OSCertHandles intermediate; |
| 223 return CalculateChainFingerprint256(os_cert_handle(), intermediate); |
| 224 } |
| 225 |
220 // The fingerprint of the intermediate CA certificates. | 226 // The fingerprint of the intermediate CA certificates. |
221 const SHA1HashValue& ca_fingerprint() const { | 227 const SHA1HashValue& ca_fingerprint() const { |
222 return ca_fingerprint_; | 228 return ca_fingerprint_; |
223 } | 229 } |
224 | 230 |
225 // Gets the DNS names in the certificate. Pursuant to RFC 2818, Section 3.1 | 231 // Gets the DNS names in the certificate. Pursuant to RFC 2818, Section 3.1 |
226 // Server Identity, if the certificate has a subjectAltName extension of | 232 // Server Identity, if the certificate has a subjectAltName extension of |
227 // type dNSName, this method gets the DNS names in that extension. | 233 // type dNSName, this method gets the DNS names in that extension. |
228 // Otherwise, it gets the common name in the subject field. | 234 // Otherwise, it gets the common name in the subject field. |
229 void GetDNSNames(std::vector<std::string>* dns_names) const; | 235 void GetDNSNames(std::vector<std::string>* dns_names) const; |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 // based on the type of the certificate. | 516 // based on the type of the certificate. |
511 std::string default_nickname_; | 517 std::string default_nickname_; |
512 #endif | 518 #endif |
513 | 519 |
514 DISALLOW_COPY_AND_ASSIGN(X509Certificate); | 520 DISALLOW_COPY_AND_ASSIGN(X509Certificate); |
515 }; | 521 }; |
516 | 522 |
517 } // namespace net | 523 } // namespace net |
518 | 524 |
519 #endif // NET_CERT_X509_CERTIFICATE_H_ | 525 #endif // NET_CERT_X509_CERTIFICATE_H_ |
OLD | NEW |