| 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_BASE_X509_UTIL_H_ | 5 #ifndef NET_BASE_X509_UTIL_H_ |
| 6 #define NET_BASE_X509_UTIL_H_ | 6 #define NET_BASE_X509_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| 12 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
| 13 | 13 |
| 14 namespace crypto { | 14 namespace crypto { |
| 15 class ECPrivateKey; | 15 class ECPrivateKey; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 | 19 |
| 20 class X509Certificate; | 20 class X509Certificate; |
| 21 | 21 |
| 22 namespace x509_util { | 22 namespace x509_util { |
| 23 | 23 |
| 24 // Returns true if the times can be used to create an X.509 certificate. | 24 // Returns true if the times can be used to create an X.509 certificate. |
| 25 // Certificates can accept dates from Jan 1st, 1 to Dec 31, 9999. A bug in NSS | 25 // Certificates can accept dates from Jan 1st, 1 to Dec 31, 9999. A bug in NSS |
| 26 // limited the range to 1950-9999 | 26 // limited the range to 1950-9999 |
| 27 // (https://bugzilla.mozilla.org/show_bug.cgi?id=786531). This function will | 27 // (https://bugzilla.mozilla.org/show_bug.cgi?id=786531). This function will |
| 28 // return whether it is supported by the currently used crypto library. | 28 // return whether it is supported by the currently used crypto library. |
| 29 bool IsSupportedValidityRange(base::Time not_valid_before, | 29 NET_EXPORT_PRIVATE bool IsSupportedValidityRange(base::Time not_valid_before, |
| 30 base::Time not_valid_after); | 30 base::Time not_valid_after); |
| 31 | 31 |
| 32 // Creates a server bound certificate containing the public key in |key|. | 32 // Creates a server bound certificate containing the public key in |key|. |
| 33 // Domain, serial number and validity period are given as | 33 // Domain, serial number and validity period are given as |
| 34 // parameters. The certificate is signed by the private key in |key|. | 34 // parameters. The certificate is signed by the private key in |key|. |
| 35 // The hashing algorithm for the signature is SHA-1. | 35 // The hashing algorithm for the signature is SHA-1. |
| 36 // | 36 // |
| 37 // See Internet Draft draft-balfanz-tls-obc-00 for more details: | 37 // See Internet Draft draft-balfanz-tls-obc-00 for more details: |
| 38 // http://tools.ietf.org/html/draft-balfanz-tls-obc-00 | 38 // http://tools.ietf.org/html/draft-balfanz-tls-obc-00 |
| 39 bool NET_EXPORT_PRIVATE CreateDomainBoundCertEC( | 39 NET_EXPORT_PRIVATE bool CreateDomainBoundCertEC( |
| 40 crypto::ECPrivateKey* key, | 40 crypto::ECPrivateKey* key, |
| 41 const std::string& domain, | 41 const std::string& domain, |
| 42 uint32 serial_number, | 42 uint32 serial_number, |
| 43 base::Time not_valid_before, | 43 base::Time not_valid_before, |
| 44 base::Time not_valid_after, | 44 base::Time not_valid_after, |
| 45 std::string* der_cert); | 45 std::string* der_cert); |
| 46 | 46 |
| 47 // Comparator for use in STL algorithms that will sort client certificates by | 47 // Comparator for use in STL algorithms that will sort client certificates by |
| 48 // order of preference. | 48 // order of preference. |
| 49 // Returns true if |a| is more preferable than |b|, allowing it to be used | 49 // Returns true if |a| is more preferable than |b|, allowing it to be used |
| (...skipping 14 matching lines...) Expand all Loading... |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 base::Time now_; | 66 base::Time now_; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 } // namespace x509_util | 69 } // namespace x509_util |
| 70 | 70 |
| 71 } // namespace net | 71 } // namespace net |
| 72 | 72 |
| 73 #endif // NET_BASE_X509_UTIL_H_ | 73 #endif // NET_BASE_X509_UTIL_H_ |
| OLD | NEW |