OLD | NEW |
1 // Copyright (c) 2011 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_CERTIFICATE_H_ | 5 #ifndef NET_BASE_X509_CERTIFICATE_H_ |
6 #define NET_BASE_X509_CERTIFICATE_H_ | 6 #define NET_BASE_X509_CERTIFICATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 int flags, | 386 int flags, |
387 CRLSet* crl_set, | 387 CRLSet* crl_set, |
388 CertVerifyResult* verify_result) const; | 388 CertVerifyResult* verify_result) const; |
389 | 389 |
390 // Verifies that |hostname| matches this certificate. | 390 // Verifies that |hostname| matches this certificate. |
391 // Does not verify that the certificate is valid, only that the certificate | 391 // Does not verify that the certificate is valid, only that the certificate |
392 // matches this host. | 392 // matches this host. |
393 // Returns true if it matches. | 393 // Returns true if it matches. |
394 bool VerifyNameMatch(const std::string& hostname) const; | 394 bool VerifyNameMatch(const std::string& hostname) const; |
395 | 395 |
396 // This method returns the DER encoded certificate. | 396 // Obtains the DER encoded certificate data for |cert_handle|. On success, |
397 // If the return value is true then the DER encoded certificate is available. | 397 // returns true and writes the DER encoded certificate to |*der_encoded|. |
398 // The content of the DER encoded certificate is written to |encoded|. | 398 static bool GetDEREncoded(OSCertHandle cert_handle, |
399 bool GetDEREncoded(std::string* encoded); | 399 std::string* der_encoded); |
400 | 400 |
401 // Returns the OSCertHandle of this object. Because of caching, this may | 401 // Returns the OSCertHandle of this object. Because of caching, this may |
402 // differ from the OSCertHandle originally supplied during initialization. | 402 // differ from the OSCertHandle originally supplied during initialization. |
403 // Note: On Windows, CryptoAPI may return unexpected results if this handle | 403 // Note: On Windows, CryptoAPI may return unexpected results if this handle |
404 // is used across multiple threads. For more details, see | 404 // is used across multiple threads. For more details, see |
405 // CreateOSCertChainForCert(). | 405 // CreateOSCertChainForCert(). |
406 OSCertHandle os_cert_handle() const { return cert_handle_; } | 406 OSCertHandle os_cert_handle() const { return cert_handle_; } |
407 | 407 |
408 // Returns true if two OSCertHandles refer to identical certificates. | 408 // Returns true if two OSCertHandles refer to identical certificates. |
409 static bool IsSameOSCert(OSCertHandle a, OSCertHandle b); | 409 static bool IsSameOSCert(OSCertHandle a, OSCertHandle b); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 // (Marked mutable because it's used in a const method.) | 552 // (Marked mutable because it's used in a const method.) |
553 mutable base::Lock verification_lock_; | 553 mutable base::Lock verification_lock_; |
554 #endif | 554 #endif |
555 | 555 |
556 DISALLOW_COPY_AND_ASSIGN(X509Certificate); | 556 DISALLOW_COPY_AND_ASSIGN(X509Certificate); |
557 }; | 557 }; |
558 | 558 |
559 } // namespace net | 559 } // namespace net |
560 | 560 |
561 #endif // NET_BASE_X509_CERTIFICATE_H_ | 561 #endif // NET_BASE_X509_CERTIFICATE_H_ |
OLD | NEW |