Chromium Code Reviews| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 typedef X509* OSCertHandle; | 67 typedef X509* OSCertHandle; |
| 68 #elif defined(USE_NSS) | 68 #elif defined(USE_NSS) |
| 69 typedef struct CERTCertificateStr* OSCertHandle; | 69 typedef struct CERTCertificateStr* OSCertHandle; |
| 70 #else | 70 #else |
| 71 // TODO(ericroman): not implemented | 71 // TODO(ericroman): not implemented |
| 72 typedef void* OSCertHandle; | 72 typedef void* OSCertHandle; |
| 73 #endif | 73 #endif |
| 74 | 74 |
| 75 typedef std::vector<OSCertHandle> OSCertHandles; | 75 typedef std::vector<OSCertHandle> OSCertHandles; |
| 76 | 76 |
| 77 enum { | |
| 78 NONE, | |
| 79 RSA, | |
| 80 DSA, | |
| 81 ECDSA, | |
| 82 DH, | |
|
agl
2011/11/16 15:57:55
OTHER?
(For example, ECDH. I wouldn't want code t
| |
| 83 } PublicKeyType; | |
| 84 | |
| 77 // Predicate functor used in maps when X509Certificate is used as the key. | 85 // Predicate functor used in maps when X509Certificate is used as the key. |
| 78 class NET_EXPORT LessThan { | 86 class NET_EXPORT LessThan { |
| 79 public: | 87 public: |
| 80 bool operator() (X509Certificate* lhs, X509Certificate* rhs) const; | 88 bool operator() (X509Certificate* lhs, X509Certificate* rhs) const; |
| 81 }; | 89 }; |
| 82 | 90 |
| 83 enum VerifyFlags { | 91 enum VerifyFlags { |
| 84 VERIFY_REV_CHECKING_ENABLED = 1 << 0, | 92 VERIFY_REV_CHECKING_ENABLED = 1 << 0, |
| 85 VERIFY_EV_CERT = 1 << 1, | 93 VERIFY_EV_CERT = 1 << 1, |
| 86 }; | 94 }; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 397 static bool GetPEMEncoded(OSCertHandle cert_handle, | 405 static bool GetPEMEncoded(OSCertHandle cert_handle, |
| 398 std::string* pem_encoded); | 406 std::string* pem_encoded); |
| 399 | 407 |
| 400 // Encodes the entire certificate chain (this certificate and any | 408 // Encodes the entire certificate chain (this certificate and any |
| 401 // intermediate certificates stored in |intermediate_ca_certs_|) as a series | 409 // intermediate certificates stored in |intermediate_ca_certs_|) as a series |
| 402 // of PEM encoded strings. Returns true if all certificates were encoded, | 410 // of PEM encoded strings. Returns true if all certificates were encoded, |
| 403 // storig the result in |*pem_encoded|, with this certificate stored as | 411 // storig the result in |*pem_encoded|, with this certificate stored as |
| 404 // the first element. | 412 // the first element. |
| 405 bool GetPEMEncodedChain(std::vector<std::string>* pem_encoded) const; | 413 bool GetPEMEncodedChain(std::vector<std::string>* pem_encoded) const; |
| 406 | 414 |
| 415 // Returns the length of the public key in bits. | |
| 416 static unsigned int GetPublicKeyLengthInBits(OSCertHandle cert_handle); | |
| 417 | |
| 407 // Returns the OSCertHandle of this object. Because of caching, this may | 418 // Returns the OSCertHandle of this object. Because of caching, this may |
| 408 // differ from the OSCertHandle originally supplied during initialization. | 419 // differ from the OSCertHandle originally supplied during initialization. |
| 409 // Note: On Windows, CryptoAPI may return unexpected results if this handle | 420 // Note: On Windows, CryptoAPI may return unexpected results if this handle |
| 410 // is used across multiple threads. For more details, see | 421 // is used across multiple threads. For more details, see |
| 411 // CreateOSCertChainForCert(). | 422 // CreateOSCertChainForCert(). |
| 412 OSCertHandle os_cert_handle() const { return cert_handle_; } | 423 OSCertHandle os_cert_handle() const { return cert_handle_; } |
| 413 | 424 |
| 414 // Returns true if two OSCertHandles refer to identical certificates. | 425 // Returns true if two OSCertHandles refer to identical certificates. |
| 415 static bool IsSameOSCert(OSCertHandle a, OSCertHandle b); | 426 static bool IsSameOSCert(OSCertHandle a, OSCertHandle b); |
| 416 | 427 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 // (Marked mutable because it's used in a const method.) | 570 // (Marked mutable because it's used in a const method.) |
| 560 mutable base::Lock verification_lock_; | 571 mutable base::Lock verification_lock_; |
| 561 #endif | 572 #endif |
| 562 | 573 |
| 563 DISALLOW_COPY_AND_ASSIGN(X509Certificate); | 574 DISALLOW_COPY_AND_ASSIGN(X509Certificate); |
| 564 }; | 575 }; |
| 565 | 576 |
| 566 } // namespace net | 577 } // namespace net |
| 567 | 578 |
| 568 #endif // NET_BASE_X509_CERTIFICATE_H_ | 579 #endif // NET_BASE_X509_CERTIFICATE_H_ |
| OLD | NEW |