| 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 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 } | 950 } |
| 951 } | 951 } |
| 952 } | 952 } |
| 953 | 953 |
| 954 AppendPublicKeyHashes(completed_chain, &verify_result->public_key_hashes); | 954 AppendPublicKeyHashes(completed_chain, &verify_result->public_key_hashes); |
| 955 verify_result->is_issued_by_known_root = IsIssuedByKnownRoot(completed_chain); | 955 verify_result->is_issued_by_known_root = IsIssuedByKnownRoot(completed_chain); |
| 956 | 956 |
| 957 return OK; | 957 return OK; |
| 958 } | 958 } |
| 959 | 959 |
| 960 bool X509Certificate::GetDEREncoded(std::string* encoded) { | 960 // static |
| 961 encoded->clear(); | 961 bool X509Certificate::GetDEREncoded(X509Certificate::OSCertHandle cert_handle, |
| 962 std::string* encoded) { |
| 962 CSSM_DATA der_data; | 963 CSSM_DATA der_data; |
| 963 if (SecCertificateGetData(cert_handle_, &der_data) == noErr) { | 964 if (SecCertificateGetData(cert_handle, &der_data) != noErr) |
| 964 encoded->append(reinterpret_cast<char*>(der_data.Data), | 965 return false; |
| 965 der_data.Length); | 966 encoded->assign(reinterpret_cast<char*>(der_data.Data), |
| 966 return true; | 967 der_data.Length); |
| 967 } | 968 return true; |
| 968 return false; | |
| 969 } | 969 } |
| 970 | 970 |
| 971 // static | 971 // static |
| 972 bool X509Certificate::IsSameOSCert(X509Certificate::OSCertHandle a, | 972 bool X509Certificate::IsSameOSCert(X509Certificate::OSCertHandle a, |
| 973 X509Certificate::OSCertHandle b) { | 973 X509Certificate::OSCertHandle b) { |
| 974 DCHECK(a && b); | 974 DCHECK(a && b); |
| 975 if (a == b) | 975 if (a == b) |
| 976 return true; | 976 return true; |
| 977 if (CFEqual(a, b)) | 977 if (CFEqual(a, b)) |
| 978 return true; | 978 return true; |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1368 CSSM_DATA cert_data; | 1368 CSSM_DATA cert_data; |
| 1369 OSStatus status = SecCertificateGetData(cert_handle, &cert_data); | 1369 OSStatus status = SecCertificateGetData(cert_handle, &cert_data); |
| 1370 if (status) | 1370 if (status) |
| 1371 return false; | 1371 return false; |
| 1372 | 1372 |
| 1373 return pickle->WriteData(reinterpret_cast<char*>(cert_data.Data), | 1373 return pickle->WriteData(reinterpret_cast<char*>(cert_data.Data), |
| 1374 cert_data.Length); | 1374 cert_data.Length); |
| 1375 } | 1375 } |
| 1376 | 1376 |
| 1377 } // namespace net | 1377 } // namespace net |
| OLD | NEW |