| 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 #include "net/cert/x509_util.h" | 5 #include "net/cert/x509_util.h" |
| 6 #include "net/cert/x509_util_openssl.h" | 6 #include "net/cert/x509_util_openssl.h" |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 const base::Time kYear10000 = kEpoch + | 41 const base::Time kYear10000 = kEpoch + |
| 42 base::TimeDelta::FromDays(kDaysFromUnixEpochToYear10000); | 42 base::TimeDelta::FromDays(kDaysFromUnixEpochToYear10000); |
| 43 | 43 |
| 44 if (not_valid_before < kYear0001 || not_valid_before >= kYear10000 || | 44 if (not_valid_before < kYear0001 || not_valid_before >= kYear10000 || |
| 45 not_valid_after < kYear0001 || not_valid_after >= kYear10000) | 45 not_valid_after < kYear0001 || not_valid_after >= kYear10000) |
| 46 return false; | 46 return false; |
| 47 | 47 |
| 48 return true; | 48 return true; |
| 49 } | 49 } |
| 50 | 50 |
| 51 bool CreateDomainBoundCertEC( | 51 bool CreateDomainBoundCertECInternal( |
| 52 crypto::ECPrivateKey* key, | 52 crypto::ECPrivateKey* key, |
| 53 crypto::HMAC::HashAlgorithm alg, |
| 53 const std::string& domain, | 54 const std::string& domain, |
| 54 uint32 serial_number, | 55 uint32 serial_number, |
| 55 base::Time not_valid_before, | 56 base::Time not_valid_before, |
| 56 base::Time not_valid_after, | 57 base::Time not_valid_after, |
| 57 std::string* der_cert) { | 58 std::string* der_cert) { |
| 58 NOTIMPLEMENTED(); | 59 NOTIMPLEMENTED(); |
| 59 return false; | 60 return false; |
| 60 } | 61 } |
| 61 | 62 |
| 62 bool CreateSelfSignedCert(crypto::RSAPrivateKey* key, | 63 bool CreateSelfSignedCertInternal(crypto::RSAPrivateKey* key, |
| 63 const std::string& common_name, | 64 crypto::HMAC::HashAlgorithm alg, |
| 64 uint32 serial_number, | 65 const std::string& common_name, |
| 65 base::Time not_valid_before, | 66 uint32 serial_number, |
| 66 base::Time not_valid_after, | 67 base::Time not_valid_before, |
| 67 std::string* der_encoded) { | 68 base::Time not_valid_after, |
| 69 std::string* der_encoded) { |
| 68 NOTIMPLEMENTED(); | 70 NOTIMPLEMENTED(); |
| 69 return false; | 71 return false; |
| 70 } | 72 } |
| 71 | 73 |
| 72 bool ParsePrincipalKeyAndValueByIndex(X509_NAME* name, | 74 bool ParsePrincipalKeyAndValueByIndex(X509_NAME* name, |
| 73 int index, | 75 int index, |
| 74 std::string* key, | 76 std::string* key, |
| 75 std::string* value) { | 77 std::string* value) { |
| 76 X509_NAME_ENTRY* entry = X509_NAME_get_entry(name, index); | 78 X509_NAME_ENTRY* entry = X509_NAME_get_entry(name, index); |
| 77 if (!entry) | 79 if (!entry) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 x509_time->length); | 122 x509_time->length); |
| 121 | 123 |
| 122 CertDateFormat format = x509_time->type == V_ASN1_UTCTIME ? | 124 CertDateFormat format = x509_time->type == V_ASN1_UTCTIME ? |
| 123 CERT_DATE_FORMAT_UTC_TIME : CERT_DATE_FORMAT_GENERALIZED_TIME; | 125 CERT_DATE_FORMAT_UTC_TIME : CERT_DATE_FORMAT_GENERALIZED_TIME; |
| 124 return ParseCertificateDate(str_date, format, time); | 126 return ParseCertificateDate(str_date, format, time); |
| 125 } | 127 } |
| 126 | 128 |
| 127 } // namespace x509_util | 129 } // namespace x509_util |
| 128 | 130 |
| 129 } // namespace net | 131 } // namespace net |
| OLD | NEW |