OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ct_objects_extractor.h" | 5 #include "net/cert/ct_objects_extractor.h" |
6 | 6 |
7 #include <cert.h> | 7 #include <cert.h> |
8 #include <secasn1.h> | 8 #include <secasn1.h> |
9 #include <secitem.h> | 9 #include <secitem.h> |
10 #include <secoid.h> | 10 #include <secoid.h> |
(...skipping 23 matching lines...) Expand all Loading... |
34 // platforms where X509Certificate::OSCertHandle refers to a different type | 34 // platforms where X509Certificate::OSCertHandle refers to a different type |
35 // than a CERTCertificate*. | 35 // than a CERTCertificate*. |
36 struct NSSCertWrapper { | 36 struct NSSCertWrapper { |
37 explicit NSSCertWrapper(X509Certificate::OSCertHandle cert_handle); | 37 explicit NSSCertWrapper(X509Certificate::OSCertHandle cert_handle); |
38 ~NSSCertWrapper() {} | 38 ~NSSCertWrapper() {} |
39 | 39 |
40 ScopedCERTCertificate cert; | 40 ScopedCERTCertificate cert; |
41 }; | 41 }; |
42 | 42 |
43 NSSCertWrapper::NSSCertWrapper(X509Certificate::OSCertHandle cert_handle) { | 43 NSSCertWrapper::NSSCertWrapper(X509Certificate::OSCertHandle cert_handle) { |
44 #if defined(USE_NSS) | 44 #if defined(USE_NSS_CERTS) |
45 cert.reset(CERT_DupCertificate(cert_handle)); | 45 cert.reset(CERT_DupCertificate(cert_handle)); |
46 #else | 46 #else |
47 SECItem der_cert; | 47 SECItem der_cert; |
48 std::string der_data; | 48 std::string der_data; |
49 if (!X509Certificate::GetDEREncoded(cert_handle, &der_data)) | 49 if (!X509Certificate::GetDEREncoded(cert_handle, &der_data)) |
50 return; | 50 return; |
51 der_cert.data = | 51 der_cert.data = |
52 reinterpret_cast<unsigned char*>(const_cast<char*>(der_data.data())); | 52 reinterpret_cast<unsigned char*>(const_cast<char*>(der_data.data())); |
53 der_cert.len = der_data.size(); | 53 der_cert.len = der_data.size(); |
54 | 54 |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 if (!match) | 608 if (!match) |
609 return false; | 609 return false; |
610 | 610 |
611 return GetSCTListFromOCSPExtension(arena.get(), match->single_extensions, | 611 return GetSCTListFromOCSPExtension(arena.get(), match->single_extensions, |
612 sct_list); | 612 sct_list); |
613 } | 613 } |
614 | 614 |
615 } // namespace ct | 615 } // namespace ct |
616 | 616 |
617 } // namespace net | 617 } // namespace net |
OLD | NEW |