| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 const base::Time kYear10000 = kEpoch + | 204 const base::Time kYear10000 = kEpoch + |
| 205 base::TimeDelta::FromDays(kDaysFromUnixEpochToYear10000); | 205 base::TimeDelta::FromDays(kDaysFromUnixEpochToYear10000); |
| 206 | 206 |
| 207 if (not_valid_before < kYear0001 || not_valid_before >= kYear10000 || | 207 if (not_valid_before < kYear0001 || not_valid_before >= kYear10000 || |
| 208 not_valid_after < kYear0001 || not_valid_after >= kYear10000) | 208 not_valid_after < kYear0001 || not_valid_after >= kYear10000) |
| 209 return false; | 209 return false; |
| 210 | 210 |
| 211 return true; | 211 return true; |
| 212 } | 212 } |
| 213 | 213 |
| 214 bool CreateDomainBoundCertEC( | 214 bool CreateChannelIDEC( |
| 215 crypto::ECPrivateKey* key, | 215 crypto::ECPrivateKey* key, |
| 216 DigestAlgorithm alg, | 216 DigestAlgorithm alg, |
| 217 const std::string& domain, | 217 const std::string& domain, |
| 218 uint32 serial_number, | 218 uint32 serial_number, |
| 219 base::Time not_valid_before, | 219 base::Time not_valid_before, |
| 220 base::Time not_valid_after, | 220 base::Time not_valid_after, |
| 221 std::string* der_cert) { | 221 std::string* der_cert) { |
| 222 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); | 222 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); |
| 223 // Create certificate. | 223 // Create certificate. |
| 224 crypto::ScopedOpenSSL<X509, X509_free> cert( | 224 crypto::ScopedOpenSSL<X509, X509_free> cert( |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 x509_time->length); | 345 x509_time->length); |
| 346 | 346 |
| 347 CertDateFormat format = x509_time->type == V_ASN1_UTCTIME ? | 347 CertDateFormat format = x509_time->type == V_ASN1_UTCTIME ? |
| 348 CERT_DATE_FORMAT_UTC_TIME : CERT_DATE_FORMAT_GENERALIZED_TIME; | 348 CERT_DATE_FORMAT_UTC_TIME : CERT_DATE_FORMAT_GENERALIZED_TIME; |
| 349 return ParseCertificateDate(str_date, format, time); | 349 return ParseCertificateDate(str_date, format, time); |
| 350 } | 350 } |
| 351 | 351 |
| 352 } // namespace x509_util | 352 } // namespace x509_util |
| 353 | 353 |
| 354 } // namespace net | 354 } // namespace net |
| OLD | NEW |