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 "chrome/common/net/x509_certificate_model.h" | 5 #include "chrome/common/net/x509_certificate_model.h" |
6 | 6 |
7 #include <cert.h> | 7 #include <cert.h> |
8 #include <cms.h> | 8 #include <cms.h> |
9 #include <hasht.h> | 9 #include <hasht.h> |
10 #include <keyhi.h> // SECKEY_DestroyPrivateKey | 10 #include <keyhi.h> // SECKEY_DestroyPrivateKey |
11 #include <keythi.h> // SECKEYPrivateKey | 11 #include <keythi.h> // SECKEYPrivateKey |
12 #include <pk11pub.h> // PK11_FindKeyByAnyCert | 12 #include <pk11pub.h> // PK11_FindKeyByAnyCert |
13 #include <seccomon.h> // SECItem | 13 #include <seccomon.h> // SECItem |
14 #include <sechash.h> | 14 #include <sechash.h> |
15 #include <stddef.h> | 15 #include <stddef.h> |
16 #include <stdint.h> | 16 #include <stdint.h> |
17 #include <string.h> | 17 #include <string.h> |
18 | 18 |
| 19 #include <memory> |
| 20 |
19 #include "base/logging.h" | 21 #include "base/logging.h" |
20 #include "base/numerics/safe_conversions.h" | 22 #include "base/numerics/safe_conversions.h" |
21 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
22 #include "chrome/third_party/mozilla_security_manager/nsNSSCertHelper.h" | 24 #include "chrome/third_party/mozilla_security_manager/nsNSSCertHelper.h" |
23 #include "chrome/third_party/mozilla_security_manager/nsNSSCertificate.h" | 25 #include "chrome/third_party/mozilla_security_manager/nsNSSCertificate.h" |
24 #include "chrome/third_party/mozilla_security_manager/nsUsageArrayHelper.h" | 26 #include "chrome/third_party/mozilla_security_manager/nsUsageArrayHelper.h" |
25 #include "crypto/nss_util.h" | 27 #include "crypto/nss_util.h" |
26 #include "crypto/scoped_nss_types.h" | 28 #include "crypto/scoped_nss_types.h" |
27 #include "net/cert/x509_certificate.h" | 29 #include "net/cert/x509_certificate.h" |
28 | 30 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 89 } |
88 | 90 |
89 //////////////////////////////////////////////////////////////////////////////// | 91 //////////////////////////////////////////////////////////////////////////////// |
90 // NSS certificate export functions. | 92 // NSS certificate export functions. |
91 | 93 |
92 struct NSSCMSMessageDeleter { | 94 struct NSSCMSMessageDeleter { |
93 inline void operator()(NSSCMSMessage* x) const { | 95 inline void operator()(NSSCMSMessage* x) const { |
94 NSS_CMSMessage_Destroy(x); | 96 NSS_CMSMessage_Destroy(x); |
95 } | 97 } |
96 }; | 98 }; |
97 typedef scoped_ptr<NSSCMSMessage, NSSCMSMessageDeleter> ScopedNSSCMSMessage; | 99 typedef std::unique_ptr<NSSCMSMessage, NSSCMSMessageDeleter> |
| 100 ScopedNSSCMSMessage; |
98 | 101 |
99 struct FreeNSSCMSSignedData { | 102 struct FreeNSSCMSSignedData { |
100 inline void operator()(NSSCMSSignedData* x) const { | 103 inline void operator()(NSSCMSSignedData* x) const { |
101 NSS_CMSSignedData_Destroy(x); | 104 NSS_CMSSignedData_Destroy(x); |
102 } | 105 } |
103 }; | 106 }; |
104 typedef scoped_ptr<NSSCMSSignedData, FreeNSSCMSSignedData> | 107 typedef std::unique_ptr<NSSCMSSignedData, FreeNSSCMSSignedData> |
105 ScopedNSSCMSSignedData; | 108 ScopedNSSCMSSignedData; |
106 | 109 |
107 } // namespace | 110 } // namespace |
108 | 111 |
109 namespace x509_certificate_model { | 112 namespace x509_certificate_model { |
110 | 113 |
111 using net::X509Certificate; | 114 using net::X509Certificate; |
112 using std::string; | 115 using std::string; |
113 | 116 |
114 string GetCertNameOrNickname(X509Certificate::OSCertHandle cert_handle) { | 117 string GetCertNameOrNickname(X509Certificate::OSCertHandle cert_handle) { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 string ProcessSubjectPublicKeyInfo(X509Certificate::OSCertHandle cert_handle) { | 300 string ProcessSubjectPublicKeyInfo(X509Certificate::OSCertHandle cert_handle) { |
298 return psm::ProcessSubjectPublicKeyInfo(&cert_handle->subjectPublicKeyInfo); | 301 return psm::ProcessSubjectPublicKeyInfo(&cert_handle->subjectPublicKeyInfo); |
299 } | 302 } |
300 | 303 |
301 string ProcessRawBitsSignatureWrap(X509Certificate::OSCertHandle cert_handle) { | 304 string ProcessRawBitsSignatureWrap(X509Certificate::OSCertHandle cert_handle) { |
302 return ProcessRawBits(cert_handle->signatureWrap.signature.data, | 305 return ProcessRawBits(cert_handle->signatureWrap.signature.data, |
303 cert_handle->signatureWrap.signature.len); | 306 cert_handle->signatureWrap.signature.len); |
304 } | 307 } |
305 | 308 |
306 } // namespace x509_certificate_model | 309 } // namespace x509_certificate_model |
OLD | NEW |