| 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 #include "net/base/x509_certificate.h" | 5 #include "net/base/x509_certificate.h" |
| 6 | 6 |
| 7 #include <CommonCrypto/CommonDigest.h> | 7 #include <CommonCrypto/CommonDigest.h> |
| 8 #include <CoreServices/CoreServices.h> | 8 #include <CoreServices/CoreServices.h> |
| 9 #include <Security/Security.h> | 9 #include <Security/Security.h> |
| 10 #include <time.h> | 10 #include <time.h> |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 | 715 |
| 716 // static | 716 // static |
| 717 X509Certificate* X509Certificate::CreateSelfSigned( | 717 X509Certificate* X509Certificate::CreateSelfSigned( |
| 718 crypto::RSAPrivateKey* key, | 718 crypto::RSAPrivateKey* key, |
| 719 const std::string& subject, | 719 const std::string& subject, |
| 720 uint32 serial_number, | 720 uint32 serial_number, |
| 721 base::TimeDelta valid_duration) { | 721 base::TimeDelta valid_duration) { |
| 722 DCHECK(key); | 722 DCHECK(key); |
| 723 DCHECK(!subject.empty()); | 723 DCHECK(!subject.empty()); |
| 724 | 724 |
| 725 if (valid_duration.InSeconds() > UINT32_MAX) { | 725 if (valid_duration.InSeconds() > kuint32max) { |
| 726 LOG(ERROR) << "valid_duration too big" << valid_duration.InSeconds(); | 726 LOG(ERROR) << "valid_duration too big" << valid_duration.InSeconds(); |
| 727 valid_duration = base::TimeDelta::FromSeconds(UINT32_MAX); | 727 valid_duration = base::TimeDelta::FromSeconds(kuint32max); |
| 728 } | 728 } |
| 729 | 729 |
| 730 // There is a comment in | 730 // There is a comment in |
| 731 // http://www.opensource.apple.com/source/security_certtool/security_certtool-
31828/src/CertTool.cpp | 731 // http://www.opensource.apple.com/source/security_certtool/security_certtool-
31828/src/CertTool.cpp |
| 732 // that serial_numbers being passed into CSSM_TP_SubmitCredRequest can't have | 732 // that serial_numbers being passed into CSSM_TP_SubmitCredRequest can't have |
| 733 // their high bit set. We will continue though and mask it out below. | 733 // their high bit set. We will continue though and mask it out below. |
| 734 if (serial_number & 0x80000000) | 734 if (serial_number & 0x80000000) |
| 735 LOG(ERROR) << "serial_number has high bit set " << serial_number; | 735 LOG(ERROR) << "serial_number has high bit set " << serial_number; |
| 736 | 736 |
| 737 // NSS is used to parse the subject string into a set of | 737 // NSS is used to parse the subject string into a set of |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 CSSM_DATA cert_data; | 1508 CSSM_DATA cert_data; |
| 1509 OSStatus status = SecCertificateGetData(cert_handle, &cert_data); | 1509 OSStatus status = SecCertificateGetData(cert_handle, &cert_data); |
| 1510 if (status) | 1510 if (status) |
| 1511 return false; | 1511 return false; |
| 1512 | 1512 |
| 1513 return pickle->WriteData(reinterpret_cast<char*>(cert_data.Data), | 1513 return pickle->WriteData(reinterpret_cast<char*>(cert_data.Data), |
| 1514 cert_data.Length); | 1514 cert_data.Length); |
| 1515 } | 1515 } |
| 1516 | 1516 |
| 1517 } // namespace net | 1517 } // namespace net |
| OLD | NEW |