| 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 <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 // Gets the DNS names in the certificate. Pursuant to RFC 2818, Section 3.1 | 202 // Gets the DNS names in the certificate. Pursuant to RFC 2818, Section 3.1 |
| 203 // Server Identity, if the certificate has a subjectAltName extension of | 203 // Server Identity, if the certificate has a subjectAltName extension of |
| 204 // type dNSName, this method gets the DNS names in that extension. | 204 // type dNSName, this method gets the DNS names in that extension. |
| 205 // Otherwise, it gets the common name in the subject field. | 205 // Otherwise, it gets the common name in the subject field. |
| 206 void GetDNSNames(std::vector<std::string>* dns_names) const; | 206 void GetDNSNames(std::vector<std::string>* dns_names) const; |
| 207 | 207 |
| 208 // Convenience method that returns whether this certificate has expired as of | 208 // Convenience method that returns whether this certificate has expired as of |
| 209 // now. | 209 // now. |
| 210 bool HasExpired() const; | 210 bool HasExpired() const; |
| 211 | 211 |
| 212 #if defined(OS_MACOSX) | 212 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 213 // Adds an untrusted intermediate certificate that may be needed for | 213 // Adds an untrusted intermediate certificate that may be needed for |
| 214 // chain building. | 214 // chain building. |
| 215 void AddIntermediateCertificate(SecCertificateRef cert); | 215 void AddIntermediateCertificate(OSCertHandle cert) { |
| 216 intermediate_ca_certs_.push_back(cert); |
| 217 } |
| 216 | 218 |
| 217 // Returns intermediate certificates added via AddIntermediateCertificate(). | 219 // Returns intermediate certificates added via AddIntermediateCertificate(). |
| 218 // Ownership follows the "get" rule: it is the caller's responsibility to | 220 // Ownership follows the "get" rule: it is the caller's responsibility to |
| 219 // retain the result. | 221 // retain the elements of the result. |
| 220 CFArrayRef GetIntermediateCertificates() { return intermediate_ca_certs_; } | 222 const std::vector<OSCertHandle>& GetIntermediateCertificates() const { |
| 223 return intermediate_ca_certs_; |
| 224 } |
| 221 #endif | 225 #endif |
| 222 | 226 |
| 223 // Verifies the certificate against the given hostname. Returns OK if | 227 // Verifies the certificate against the given hostname. Returns OK if |
| 224 // successful or an error code upon failure. | 228 // successful or an error code upon failure. |
| 225 // | 229 // |
| 226 // The |*verify_result| structure, including the |verify_result->cert_status| | 230 // The |*verify_result| structure, including the |verify_result->cert_status| |
| 227 // bitmask, is always filled out regardless of the return value. If the | 231 // bitmask, is always filled out regardless of the return value. If the |
| 228 // certificate has multiple errors, the corresponding status flags are set in | 232 // certificate has multiple errors, the corresponding status flags are set in |
| 229 // |verify_result->cert_status|, and the error code for the most serious | 233 // |verify_result->cert_status|, and the error code for the most serious |
| 230 // error is returned. | 234 // error is returned. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 307 |
| 304 // This certificate is not valid after |valid_expiry_| | 308 // This certificate is not valid after |valid_expiry_| |
| 305 base::Time valid_expiry_; | 309 base::Time valid_expiry_; |
| 306 | 310 |
| 307 // The fingerprint of this certificate. | 311 // The fingerprint of this certificate. |
| 308 Fingerprint fingerprint_; | 312 Fingerprint fingerprint_; |
| 309 | 313 |
| 310 // A handle to the certificate object in the underlying crypto library. | 314 // A handle to the certificate object in the underlying crypto library. |
| 311 OSCertHandle cert_handle_; | 315 OSCertHandle cert_handle_; |
| 312 | 316 |
| 313 #if defined(OS_MACOSX) | 317 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 314 // Untrusted intermediate certificates associated with this certificate | 318 // Untrusted intermediate certificates associated with this certificate |
| 315 // that may be needed for chain building. | 319 // that may be needed for chain building. |
| 316 CFMutableArrayRef intermediate_ca_certs_; | 320 std::vector<OSCertHandle> intermediate_ca_certs_; |
| 317 #endif | 321 #endif |
| 318 | 322 |
| 319 // Where the certificate comes from. | 323 // Where the certificate comes from. |
| 320 Source source_; | 324 Source source_; |
| 321 | 325 |
| 322 DISALLOW_COPY_AND_ASSIGN(X509Certificate); | 326 DISALLOW_COPY_AND_ASSIGN(X509Certificate); |
| 323 }; | 327 }; |
| 324 | 328 |
| 325 } // namespace net | 329 } // namespace net |
| 326 | 330 |
| 327 #endif // NET_BASE_X509_CERTIFICATE_H_ | 331 #endif // NET_BASE_X509_CERTIFICATE_H_ |
| OLD | NEW |