| 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 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 encCert->CertEncoding, &certificate_ref); | 688 encCert->CertEncoding, &certificate_ref); |
| 689 if (os_status != 0) { | 689 if (os_status != 0) { |
| 690 DLOG(ERROR) << "SecCertificateCreateFromData failed: " << os_status; | 690 DLOG(ERROR) << "SecCertificateCreateFromData failed: " << os_status; |
| 691 return NULL; | 691 return NULL; |
| 692 } | 692 } |
| 693 scoped_cert.reset(certificate_ref); | 693 scoped_cert.reset(certificate_ref); |
| 694 | 694 |
| 695 return CreateFromHandle(scoped_cert, X509Certificate::OSCertHandles()); | 695 return CreateFromHandle(scoped_cert, X509Certificate::OSCertHandles()); |
| 696 } | 696 } |
| 697 | 697 |
| 698 // static |
| 699 X509Certificate* X509Certificate::CreateOriginBound( |
| 700 crypto::RSAPrivateKey* key, |
| 701 const std::string& origin, |
| 702 uint32 serial_number, |
| 703 base::TimeDelta valid_duration) { |
| 704 // TODO(wtc): this cannot be implemented by creating a CE_DataAndType for |
| 705 // the origin-bound extension and adding it to certReq.extensions because |
| 706 // it is not one of the supported extensions in the CE_DataType enum type. |
| 707 // Using the DT_Other enum constant does not work. |
| 708 // |
| 709 // The relevant Apple headers are: |
| 710 // - CSSM_APPLE_TP_CERT_REQUEST is defined in cssmapple.h. |
| 711 // - CE_DataAndType, CE_DataType, and CE_Data are defined in |
| 712 // certextensions.h. |
| 713 NOTIMPLEMENTED(); |
| 714 return NULL; |
| 715 } |
| 716 |
| 698 void X509Certificate::GetSubjectAltName( | 717 void X509Certificate::GetSubjectAltName( |
| 699 std::vector<std::string>* dns_names, | 718 std::vector<std::string>* dns_names, |
| 700 std::vector<std::string>* ip_addrs) const { | 719 std::vector<std::string>* ip_addrs) const { |
| 701 if (dns_names) | 720 if (dns_names) |
| 702 dns_names->clear(); | 721 dns_names->clear(); |
| 703 if (ip_addrs) | 722 if (ip_addrs) |
| 704 ip_addrs->clear(); | 723 ip_addrs->clear(); |
| 705 | 724 |
| 706 CSSMFields fields; | 725 CSSMFields fields; |
| 707 OSStatus status = GetCertFields(cert_handle_, &fields); | 726 OSStatus status = GetCertFields(cert_handle_, &fields); |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 CSSM_DATA cert_data; | 1357 CSSM_DATA cert_data; |
| 1339 OSStatus status = SecCertificateGetData(cert_handle, &cert_data); | 1358 OSStatus status = SecCertificateGetData(cert_handle, &cert_data); |
| 1340 if (status) | 1359 if (status) |
| 1341 return false; | 1360 return false; |
| 1342 | 1361 |
| 1343 return pickle->WriteData(reinterpret_cast<char*>(cert_data.Data), | 1362 return pickle->WriteData(reinterpret_cast<char*>(cert_data.Data), |
| 1344 cert_data.Length); | 1363 cert_data.Length); |
| 1345 } | 1364 } |
| 1346 | 1365 |
| 1347 } // namespace net | 1366 } // namespace net |
| OLD | NEW |