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 "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/pickle.h" | 9 #include "base/pickle.h" |
10 #include "base/sha1.h" | 10 #include "base/sha1.h" |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 DCHECK(cert_handle) << "Failed to create self-signed certificate: " | 623 DCHECK(cert_handle) << "Failed to create self-signed certificate: " |
624 << GetLastError(); | 624 << GetLastError(); |
625 if (!cert_handle) | 625 if (!cert_handle) |
626 return NULL; | 626 return NULL; |
627 | 627 |
628 X509Certificate* cert = CreateFromHandle(cert_handle, OSCertHandles()); | 628 X509Certificate* cert = CreateFromHandle(cert_handle, OSCertHandles()); |
629 FreeOSCertHandle(cert_handle); | 629 FreeOSCertHandle(cert_handle); |
630 return cert; | 630 return cert; |
631 } | 631 } |
632 | 632 |
| 633 // static |
| 634 X509Certificate* X509Certificate::CreateOriginBound( |
| 635 crypto::RSAPrivateKey* key, |
| 636 const std::string& origin, |
| 637 uint32 serial_number, |
| 638 base::TimeDelta valid_duration) { |
| 639 NOTIMPLEMENTED(); |
| 640 return NULL; |
| 641 } |
| 642 |
633 void X509Certificate::GetSubjectAltName( | 643 void X509Certificate::GetSubjectAltName( |
634 std::vector<std::string>* dns_names, | 644 std::vector<std::string>* dns_names, |
635 std::vector<std::string>* ip_addrs) const { | 645 std::vector<std::string>* ip_addrs) const { |
636 if (dns_names) | 646 if (dns_names) |
637 dns_names->clear(); | 647 dns_names->clear(); |
638 if (ip_addrs) | 648 if (ip_addrs) |
639 ip_addrs->clear(); | 649 ip_addrs->clear(); |
640 | 650 |
641 if (!cert_handle_) | 651 if (!cert_handle_) |
642 return; | 652 return; |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 if (!CertSerializeCertificateStoreElement(cert_handle, 0, &buffer[0], | 1061 if (!CertSerializeCertificateStoreElement(cert_handle, 0, &buffer[0], |
1052 &length)) { | 1062 &length)) { |
1053 return false; | 1063 return false; |
1054 } | 1064 } |
1055 | 1065 |
1056 return pickle->WriteData(reinterpret_cast<const char*>(&buffer[0]), | 1066 return pickle->WriteData(reinterpret_cast<const char*>(&buffer[0]), |
1057 length); | 1067 length); |
1058 } | 1068 } |
1059 | 1069 |
1060 } // namespace net | 1070 } // namespace net |
OLD | NEW |