| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/cert/x509_certificate.h" | 5 #include "net/cert/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 | 10 |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 reinterpret_cast<const char*>(name_data.Data), | 267 reinterpret_cast<const char*>(name_data.Data), |
| 268 name_data.Length)); | 268 name_data.Length)); |
| 269 } | 269 } |
| 270 } | 270 } |
| 271 } | 271 } |
| 272 | 272 |
| 273 // static | 273 // static |
| 274 bool X509Certificate::GetDEREncoded(X509Certificate::OSCertHandle cert_handle, | 274 bool X509Certificate::GetDEREncoded(X509Certificate::OSCertHandle cert_handle, |
| 275 std::string* encoded) { | 275 std::string* encoded) { |
| 276 CSSM_DATA der_data; | 276 CSSM_DATA der_data; |
| 277 if (SecCertificateGetData(cert_handle, &der_data) != noErr) | 277 if (!cert_handle || SecCertificateGetData(cert_handle, &der_data) != noErr) |
| 278 return false; | 278 return false; |
| 279 encoded->assign(reinterpret_cast<char*>(der_data.Data), | 279 encoded->assign(reinterpret_cast<char*>(der_data.Data), |
| 280 der_data.Length); | 280 der_data.Length); |
| 281 return true; | 281 return true; |
| 282 } | 282 } |
| 283 | 283 |
| 284 // static | 284 // static |
| 285 bool X509Certificate::IsSameOSCert(X509Certificate::OSCertHandle a, | 285 bool X509Certificate::IsSameOSCert(X509Certificate::OSCertHandle a, |
| 286 X509Certificate::OSCertHandle b) { | 286 X509Certificate::OSCertHandle b) { |
| 287 DCHECK(a && b); | 287 DCHECK(a && b); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 *type = kPublicKeyTypeDH; | 507 *type = kPublicKeyTypeDH; |
| 508 break; | 508 break; |
| 509 default: | 509 default: |
| 510 *type = kPublicKeyTypeUnknown; | 510 *type = kPublicKeyTypeUnknown; |
| 511 *size_bits = 0; | 511 *size_bits = 0; |
| 512 break; | 512 break; |
| 513 } | 513 } |
| 514 } | 514 } |
| 515 | 515 |
| 516 } // namespace net | 516 } // namespace net |
| OLD | NEW |