| 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 <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // Create an X509Certificate from the representation stored in the given | 119 // Create an X509Certificate from the representation stored in the given |
| 120 // pickle. The data for this object is found relative to the given | 120 // pickle. The data for this object is found relative to the given |
| 121 // pickle_iter, which should be passed to the pickle's various Read* methods. | 121 // pickle_iter, which should be passed to the pickle's various Read* methods. |
| 122 // Returns NULL on failure. | 122 // Returns NULL on failure. |
| 123 static X509Certificate* CreateFromPickle(const Pickle& pickle, | 123 static X509Certificate* CreateFromPickle(const Pickle& pickle, |
| 124 void** pickle_iter); | 124 void** pickle_iter); |
| 125 | 125 |
| 126 // Creates a X509Certificate from the ground up. Used by tests that simulate | 126 // Creates a X509Certificate from the ground up. Used by tests that simulate |
| 127 // SSL connections. | 127 // SSL connections. |
| 128 X509Certificate(std::string subject, std::string issuer, | 128 X509Certificate(std::string subject, std::string issuer, |
| 129 Time start_date, Time expiration_date); | 129 base::Time start_date, base::Time expiration_date); |
| 130 | 130 |
| 131 // Appends a representation of this object to the given pickle. | 131 // Appends a representation of this object to the given pickle. |
| 132 void Persist(Pickle* pickle); | 132 void Persist(Pickle* pickle); |
| 133 | 133 |
| 134 // The subject of the certificate. For HTTPS server certificates, this | 134 // The subject of the certificate. For HTTPS server certificates, this |
| 135 // represents the web server. The common name of the subject should match | 135 // represents the web server. The common name of the subject should match |
| 136 // the host name of the web server. | 136 // the host name of the web server. |
| 137 const Principal& subject() const { return subject_; } | 137 const Principal& subject() const { return subject_; } |
| 138 | 138 |
| 139 // The issuer of the certificate. | 139 // The issuer of the certificate. |
| 140 const Principal& issuer() const { return issuer_; } | 140 const Principal& issuer() const { return issuer_; } |
| 141 | 141 |
| 142 // Time period during which the certificate is valid. More precisely, this | 142 // Time period during which the certificate is valid. More precisely, this |
| 143 // certificate is invalid before the |valid_start| date and invalid after | 143 // certificate is invalid before the |valid_start| date and invalid after |
| 144 // the |valid_expiry| date. | 144 // the |valid_expiry| date. |
| 145 // If we were unable to parse either date from the certificate (or if the cert | 145 // If we were unable to parse either date from the certificate (or if the cert |
| 146 // lacks either date), the date will be null (i.e., is_null() will be true). | 146 // lacks either date), the date will be null (i.e., is_null() will be true). |
| 147 const Time& valid_start() const { return valid_start_; } | 147 const base::Time& valid_start() const { return valid_start_; } |
| 148 const Time& valid_expiry() const { return valid_expiry_; } | 148 const base::Time& valid_expiry() const { return valid_expiry_; } |
| 149 | 149 |
| 150 // The fingerprint of this certificate. | 150 // The fingerprint of this certificate. |
| 151 const Fingerprint& fingerprint() const { return fingerprint_; } | 151 const Fingerprint& fingerprint() const { return fingerprint_; } |
| 152 | 152 |
| 153 // Gets the DNS names in the certificate. Pursuant to RFC 2818, Section 3.1 | 153 // Gets the DNS names in the certificate. Pursuant to RFC 2818, Section 3.1 |
| 154 // Server Identity, if the certificate has a subjectAltName extension of | 154 // Server Identity, if the certificate has a subjectAltName extension of |
| 155 // type dNSName, this method gets the DNS names in that extension. | 155 // type dNSName, this method gets the DNS names in that extension. |
| 156 // Otherwise, it gets the common name in the subject field. | 156 // Otherwise, it gets the common name in the subject field. |
| 157 void GetDNSNames(std::vector<std::string>* dns_names) const; | 157 void GetDNSNames(std::vector<std::string>* dns_names) const; |
| 158 | 158 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // Common object initialization code. Called by the constructors only. | 203 // Common object initialization code. Called by the constructors only. |
| 204 void Initialize(); | 204 void Initialize(); |
| 205 | 205 |
| 206 // The subject of the certificate. | 206 // The subject of the certificate. |
| 207 Principal subject_; | 207 Principal subject_; |
| 208 | 208 |
| 209 // The issuer of the certificate. | 209 // The issuer of the certificate. |
| 210 Principal issuer_; | 210 Principal issuer_; |
| 211 | 211 |
| 212 // This certificate is not valid before |valid_start_| | 212 // This certificate is not valid before |valid_start_| |
| 213 Time valid_start_; | 213 base::Time valid_start_; |
| 214 | 214 |
| 215 // This certificate is not valid after |valid_expiry_| | 215 // This certificate is not valid after |valid_expiry_| |
| 216 Time valid_expiry_; | 216 base::Time valid_expiry_; |
| 217 | 217 |
| 218 // The fingerprint of this certificate. | 218 // The fingerprint of this certificate. |
| 219 Fingerprint fingerprint_; | 219 Fingerprint fingerprint_; |
| 220 | 220 |
| 221 // A handle to the certificate object in the underlying crypto library. | 221 // A handle to the certificate object in the underlying crypto library. |
| 222 OSCertHandle cert_handle_; | 222 OSCertHandle cert_handle_; |
| 223 | 223 |
| 224 DISALLOW_COPY_AND_ASSIGN(X509Certificate); | 224 DISALLOW_COPY_AND_ASSIGN(X509Certificate); |
| 225 }; | 225 }; |
| 226 | 226 |
| 227 } // namespace net | 227 } // namespace net |
| 228 | 228 |
| 229 #endif // NET_BASE_X509_CERTIFICATE_H_ | 229 #endif // NET_BASE_X509_CERTIFICATE_H_ |
| 230 | 230 |
| OLD | NEW |