OLD | NEW |
1 // Copyright (c) 2010 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 "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 <pk11pub.h> | 10 #include <pk11pub.h> |
11 #include <sechash.h> | 11 #include <sechash.h> |
12 | 12 |
13 #include <pk11pub.h> | 13 #include <pk11pub.h> |
14 | 14 |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/nss_util.h" | |
17 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
| 17 #include "crypto/nss_util.h" |
18 #include "net/base/x509_certificate.h" | 18 #include "net/base/x509_certificate.h" |
19 #include "chrome/third_party/mozilla_security_manager/nsNSSCertHelper.h" | 19 #include "chrome/third_party/mozilla_security_manager/nsNSSCertHelper.h" |
20 #include "chrome/third_party/mozilla_security_manager/nsNSSCertificate.h" | 20 #include "chrome/third_party/mozilla_security_manager/nsNSSCertificate.h" |
21 #include "chrome/third_party/mozilla_security_manager/nsUsageArrayHelper.h" | 21 #include "chrome/third_party/mozilla_security_manager/nsUsageArrayHelper.h" |
22 | 22 |
23 namespace psm = mozilla_security_manager; | 23 namespace psm = mozilla_security_manager; |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 // Convert a char* return value from NSS into a std::string and free the NSS | 27 // Convert a char* return value from NSS into a std::string and free the NSS |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 183 |
184 string GetSubjectCommonName(X509Certificate::OSCertHandle cert_handle, | 184 string GetSubjectCommonName(X509Certificate::OSCertHandle cert_handle, |
185 const string& alternative_text) { | 185 const string& alternative_text) { |
186 return Stringize(CERT_GetCommonName(&cert_handle->subject), alternative_text); | 186 return Stringize(CERT_GetCommonName(&cert_handle->subject), alternative_text); |
187 } | 187 } |
188 | 188 |
189 bool GetTimes(X509Certificate::OSCertHandle cert_handle, | 189 bool GetTimes(X509Certificate::OSCertHandle cert_handle, |
190 base::Time* issued, base::Time* expires) { | 190 base::Time* issued, base::Time* expires) { |
191 PRTime pr_issued, pr_expires; | 191 PRTime pr_issued, pr_expires; |
192 if (CERT_GetCertTimes(cert_handle, &pr_issued, &pr_expires) == SECSuccess) { | 192 if (CERT_GetCertTimes(cert_handle, &pr_issued, &pr_expires) == SECSuccess) { |
193 *issued = base::PRTimeToBaseTime(pr_issued); | 193 *issued = crypto::PRTimeToBaseTime(pr_issued); |
194 *expires = base::PRTimeToBaseTime(pr_expires); | 194 *expires = crypto::PRTimeToBaseTime(pr_expires); |
195 return true; | 195 return true; |
196 } | 196 } |
197 return false; | 197 return false; |
198 } | 198 } |
199 | 199 |
200 string GetTitle(X509Certificate::OSCertHandle cert_handle) { | 200 string GetTitle(X509Certificate::OSCertHandle cert_handle) { |
201 return psm::GetCertTitle(cert_handle); | 201 return psm::GetCertTitle(cert_handle); |
202 } | 202 } |
203 | 203 |
204 string GetIssuerName(X509Certificate::OSCertHandle cert_handle) { | 204 string GetIssuerName(X509Certificate::OSCertHandle cert_handle) { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 371 |
372 string ProcessRawBitsSignatureWrap(X509Certificate::OSCertHandle cert_handle) { | 372 string ProcessRawBitsSignatureWrap(X509Certificate::OSCertHandle cert_handle) { |
373 return ProcessRawBits(cert_handle->signatureWrap.signature.data, | 373 return ProcessRawBits(cert_handle->signatureWrap.signature.data, |
374 cert_handle->signatureWrap.signature.len); | 374 cert_handle->signatureWrap.signature.len); |
375 } | 375 } |
376 | 376 |
377 void RegisterDynamicOids() { | 377 void RegisterDynamicOids() { |
378 } | 378 } |
379 | 379 |
380 } // namespace x509_certificate_model | 380 } // namespace x509_certificate_model |
OLD | NEW |