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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 if (status == CSSM_OK && key_usage.field()) { | 442 if (status == CSSM_OK && key_usage.field()) { |
443 const CSSM_X509_EXTENSION* ext = key_usage.GetAs<CSSM_X509_EXTENSION>(); | 443 const CSSM_X509_EXTENSION* ext = key_usage.GetAs<CSSM_X509_EXTENSION>(); |
444 const CE_ExtendedKeyUsage* ext_key_usage = | 444 const CE_ExtendedKeyUsage* ext_key_usage = |
445 reinterpret_cast<const CE_ExtendedKeyUsage*>(ext->value.parsedValue); | 445 reinterpret_cast<const CE_ExtendedKeyUsage*>(ext->value.parsedValue); |
446 if (!ExtendedKeyUsageAllows(ext_key_usage, &CSSMOID_ClientAuth)) | 446 if (!ExtendedKeyUsageAllows(ext_key_usage, &CSSMOID_ClientAuth)) |
447 return false; | 447 return false; |
448 } | 448 } |
449 return true; | 449 return true; |
450 } | 450 } |
451 | 451 |
452 CFArrayRef X509Certificate::CreateOSCertChainForCert() const { | 452 CFMutableArrayRef X509Certificate::CreateOSCertChainForCert() const { |
453 CFMutableArrayRef cert_list = | 453 CFMutableArrayRef cert_list = |
454 CFArrayCreateMutable(kCFAllocatorDefault, 0, | 454 CFArrayCreateMutable(kCFAllocatorDefault, 0, |
455 &kCFTypeArrayCallBacks); | 455 &kCFTypeArrayCallBacks); |
456 if (!cert_list) | 456 if (!cert_list) |
457 return NULL; | 457 return NULL; |
458 | 458 |
459 CFArrayAppendValue(cert_list, os_cert_handle()); | 459 CFArrayAppendValue(cert_list, os_cert_handle()); |
460 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i) | 460 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i) |
461 CFArrayAppendValue(cert_list, intermediate_ca_certs_[i]); | 461 CFArrayAppendValue(cert_list, intermediate_ca_certs_[i]); |
462 | 462 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 status = SecCertificateGetData(cert_handle, &cert_data); | 562 status = SecCertificateGetData(cert_handle, &cert_data); |
563 if (status) | 563 if (status) |
564 return false; | 564 return false; |
565 | 565 |
566 if (CSSM_CL_CertVerify(cl_handle, 0, &cert_data, &cert_data, NULL, 0)) | 566 if (CSSM_CL_CertVerify(cl_handle, 0, &cert_data, &cert_data, NULL, 0)) |
567 return false; | 567 return false; |
568 return true; | 568 return true; |
569 } | 569 } |
570 | 570 |
571 } // namespace net | 571 } // namespace net |
OLD | NEW |