| 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_openssl.h" | 5 #include "net/cert/x509_util_openssl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <openssl/asn1.h> | 8 #include <openssl/asn1.h> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 const base::Time kYear10000 = kEpoch + | 216 const base::Time kYear10000 = kEpoch + |
| 217 base::TimeDelta::FromDays(kDaysFromUnixEpochToYear10000); | 217 base::TimeDelta::FromDays(kDaysFromUnixEpochToYear10000); |
| 218 | 218 |
| 219 if (not_valid_before < kYear0001 || not_valid_before >= kYear10000 || | 219 if (not_valid_before < kYear0001 || not_valid_before >= kYear10000 || |
| 220 not_valid_after < kYear0001 || not_valid_after >= kYear10000) | 220 not_valid_after < kYear0001 || not_valid_after >= kYear10000) |
| 221 return false; | 221 return false; |
| 222 | 222 |
| 223 return true; | 223 return true; |
| 224 } | 224 } |
| 225 | 225 |
| 226 bool CreateDomainBoundCertEC( | 226 bool CreateChannelIDEC( |
| 227 crypto::ECPrivateKey* key, | 227 crypto::ECPrivateKey* key, |
| 228 DigestAlgorithm alg, | 228 DigestAlgorithm alg, |
| 229 const std::string& domain, | 229 const std::string& domain, |
| 230 uint32 serial_number, | 230 uint32 serial_number, |
| 231 base::Time not_valid_before, | 231 base::Time not_valid_before, |
| 232 base::Time not_valid_after, | 232 base::Time not_valid_after, |
| 233 std::string* der_cert) { | 233 std::string* der_cert) { |
| 234 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); | 234 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); |
| 235 // Create certificate. | 235 // Create certificate. |
| 236 ScopedX509 cert(CreateCertificate(key->key(), | 236 ScopedX509 cert(CreateCertificate(key->key(), |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 x509_time->length); | 352 x509_time->length); |
| 353 | 353 |
| 354 CertDateFormat format = x509_time->type == V_ASN1_UTCTIME ? | 354 CertDateFormat format = x509_time->type == V_ASN1_UTCTIME ? |
| 355 CERT_DATE_FORMAT_UTC_TIME : CERT_DATE_FORMAT_GENERALIZED_TIME; | 355 CERT_DATE_FORMAT_UTC_TIME : CERT_DATE_FORMAT_GENERALIZED_TIME; |
| 356 return ParseCertificateDate(str_date, format, time); | 356 return ParseCertificateDate(str_date, format, time); |
| 357 } | 357 } |
| 358 | 358 |
| 359 } // namespace x509_util | 359 } // namespace x509_util |
| 360 | 360 |
| 361 } // namespace net | 361 } // namespace net |
| OLD | NEW |