| 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 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 ip_addrs->push_back(std::string( | 731 ip_addrs->push_back(std::string( |
| 732 reinterpret_cast<const char*>(name_data.Data), | 732 reinterpret_cast<const char*>(name_data.Data), |
| 733 name_data.Length)); | 733 name_data.Length)); |
| 734 } | 734 } |
| 735 } | 735 } |
| 736 } | 736 } |
| 737 } | 737 } |
| 738 | 738 |
| 739 int X509Certificate::VerifyInternal(const std::string& hostname, | 739 int X509Certificate::VerifyInternal(const std::string& hostname, |
| 740 int flags, | 740 int flags, |
| 741 CRLSet* crl_set, |
| 741 CertVerifyResult* verify_result) const { | 742 CertVerifyResult* verify_result) const { |
| 742 ScopedCFTypeRef<CFArrayRef> trust_policies; | 743 ScopedCFTypeRef<CFArrayRef> trust_policies; |
| 743 OSStatus status = CreateTrustPolicies(hostname, flags, &trust_policies); | 744 OSStatus status = CreateTrustPolicies(hostname, flags, &trust_policies); |
| 744 if (status) | 745 if (status) |
| 745 return NetErrorFromOSStatus(status); | 746 return NetErrorFromOSStatus(status); |
| 746 | 747 |
| 747 // Create and configure a SecTrustRef, which takes our certificate(s) | 748 // Create and configure a SecTrustRef, which takes our certificate(s) |
| 748 // and our SSL SecPolicyRef. SecTrustCreateWithCertificates() takes an | 749 // and our SSL SecPolicyRef. SecTrustCreateWithCertificates() takes an |
| 749 // array of certificates, the first of which is the certificate we're | 750 // array of certificates, the first of which is the certificate we're |
| 750 // verifying, and the subsequent (optional) certificates are used for | 751 // verifying, and the subsequent (optional) certificates are used for |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1339 CSSM_DATA cert_data; | 1340 CSSM_DATA cert_data; |
| 1340 OSStatus status = SecCertificateGetData(cert_handle, &cert_data); | 1341 OSStatus status = SecCertificateGetData(cert_handle, &cert_data); |
| 1341 if (status) | 1342 if (status) |
| 1342 return false; | 1343 return false; |
| 1343 | 1344 |
| 1344 return pickle->WriteData(reinterpret_cast<char*>(cert_data.Data), | 1345 return pickle->WriteData(reinterpret_cast<char*>(cert_data.Data), |
| 1345 cert_data.Length); | 1346 cert_data.Length); |
| 1346 } | 1347 } |
| 1347 | 1348 |
| 1348 } // namespace net | 1349 } // namespace net |
| OLD | NEW |