| 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 <cert.h> | 7 #include <cert.h> |
| 8 #include <cryptohi.h> | 8 #include <cryptohi.h> |
| 9 #include <keyhi.h> | 9 #include <keyhi.h> |
| 10 #include <nss.h> | 10 #include <nss.h> |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 // Sign the ASN1 encoded cert and save it to |result|. | 742 // Sign the ASN1 encoded cert and save it to |result|. |
| 743 rv = SEC_DerSignData(arena, result, der.data, der.len, key->key(), algo_id); | 743 rv = SEC_DerSignData(arena, result, der.data, der.len, key->key(), algo_id); |
| 744 if (rv != SECSuccess) { | 744 if (rv != SECSuccess) { |
| 745 CERT_DestroyCertificate(cert); | 745 CERT_DestroyCertificate(cert); |
| 746 return NULL; | 746 return NULL; |
| 747 } | 747 } |
| 748 | 748 |
| 749 // Save the signed result to the cert. | 749 // Save the signed result to the cert. |
| 750 cert->derCert = *result; | 750 cert->derCert = *result; |
| 751 | 751 |
| 752 X509Certificate* x509_cert = | 752 X509Certificate* x509_cert = CreateFromHandle(cert, OSCertHandles()); |
| 753 CreateFromHandle(cert, SOURCE_LONE_CERT_IMPORT, OSCertHandles()); | |
| 754 CERT_DestroyCertificate(cert); | 753 CERT_DestroyCertificate(cert); |
| 755 return x509_cert; | 754 return x509_cert; |
| 756 } | 755 } |
| 757 | 756 |
| 758 void X509Certificate::GetDNSNames(std::vector<std::string>* dns_names) const { | 757 void X509Certificate::GetDNSNames(std::vector<std::string>* dns_names) const { |
| 759 dns_names->clear(); | 758 dns_names->clear(); |
| 760 | 759 |
| 761 // Compare with CERT_VerifyCertName(). | 760 // Compare with CERT_VerifyCertName(). |
| 762 GetCertSubjectAltNamesOfType(cert_handle_, certDNSName, dns_names); | 761 GetCertSubjectAltNamesOfType(cert_handle_, certDNSName, dns_names); |
| 763 | 762 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 | 1002 |
| 1004 // static | 1003 // static |
| 1005 bool X509Certificate::WriteOSCertHandleToPickle(OSCertHandle cert_handle, | 1004 bool X509Certificate::WriteOSCertHandleToPickle(OSCertHandle cert_handle, |
| 1006 Pickle* pickle) { | 1005 Pickle* pickle) { |
| 1007 return pickle->WriteData( | 1006 return pickle->WriteData( |
| 1008 reinterpret_cast<const char*>(cert_handle->derCert.data), | 1007 reinterpret_cast<const char*>(cert_handle->derCert.data), |
| 1009 cert_handle->derCert.len); | 1008 cert_handle->derCert.len); |
| 1010 } | 1009 } |
| 1011 | 1010 |
| 1012 } // namespace net | 1011 } // namespace net |
| OLD | NEW |