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 | |
717 void X509Certificate::GetSubjectAltName( | 698 void X509Certificate::GetSubjectAltName( |
718 std::vector<std::string>* dns_names, | 699 std::vector<std::string>* dns_names, |
719 std::vector<std::string>* ip_addrs) const { | 700 std::vector<std::string>* ip_addrs) const { |
720 if (dns_names) | 701 if (dns_names) |
721 dns_names->clear(); | 702 dns_names->clear(); |
722 if (ip_addrs) | 703 if (ip_addrs) |
723 ip_addrs->clear(); | 704 ip_addrs->clear(); |
724 | 705 |
725 CSSMFields fields; | 706 CSSMFields fields; |
726 OSStatus status = GetCertFields(cert_handle_, &fields); | 707 OSStatus status = GetCertFields(cert_handle_, &fields); |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1358 CSSM_DATA cert_data; | 1339 CSSM_DATA cert_data; |
1359 OSStatus status = SecCertificateGetData(cert_handle, &cert_data); | 1340 OSStatus status = SecCertificateGetData(cert_handle, &cert_data); |
1360 if (status) | 1341 if (status) |
1361 return false; | 1342 return false; |
1362 | 1343 |
1363 return pickle->WriteData(reinterpret_cast<char*>(cert_data.Data), | 1344 return pickle->WriteData(reinterpret_cast<char*>(cert_data.Data), |
1364 cert_data.Length); | 1345 cert_data.Length); |
1365 } | 1346 } |
1366 | 1347 |
1367 } // namespace net | 1348 } // namespace net |
OLD | NEW |