Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(699)

Side by Side Diff: chrome/browser/certificate_manager_model.cc

Issue 10407072: certificate manager: Disable export option for TPM-backed certs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move the extractability test out of net/ Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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/browser/certificate_manager_model.h" 5 #include "chrome/browser/certificate_manager_model.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/i18n/time_formatting.h" 8 #include "base/i18n/time_formatting.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 const net::X509Certificate& cert, 74 const net::X509Certificate& cert,
75 Column column) const { 75 Column column) const {
76 string16 rv; 76 string16 rv;
77 switch (column) { 77 switch (column) {
78 case COL_SUBJECT_NAME: 78 case COL_SUBJECT_NAME:
79 rv = UTF8ToUTF16( 79 rv = UTF8ToUTF16(
80 x509_certificate_model::GetCertNameOrNickname(cert.os_cert_handle())); 80 x509_certificate_model::GetCertNameOrNickname(cert.os_cert_handle()));
81 81
82 #if defined(OS_CHROMEOS) 82 #if defined(OS_CHROMEOS)
83 // TODO(xiyuan): Put this into a column when we have js tree-table. 83 // TODO(xiyuan): Put this into a column when we have js tree-table.
84 if (crypto::IsTPMTokenReady() && 84 if (IsHardwareBacked(&cert)) {
85 cert.os_cert_handle()->slot ==
86 cert_db().GetPrivateModule()->os_module_handle()) {
87 rv = l10n_util::GetStringFUTF16( 85 rv = l10n_util::GetStringFUTF16(
88 IDS_CERT_MANAGER_HARDWARE_BACKED_KEY_FORMAT, 86 IDS_CERT_MANAGER_HARDWARE_BACKED_KEY_FORMAT,
89 rv, 87 rv,
90 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_HARDWARE_BACKED)); 88 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_HARDWARE_BACKED));
91 } 89 }
92 #endif 90 #endif
93 break; 91 break;
94 case COL_CERTIFICATE_STORE: 92 case COL_CERTIFICATE_STORE:
95 rv = UTF8ToUTF16( 93 rv = UTF8ToUTF16(
96 x509_certificate_model::GetTokenName(cert.os_cert_handle())); 94 x509_certificate_model::GetTokenName(cert.os_cert_handle()));
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 net::CertDatabase::TrustBits trust_bits) { 144 net::CertDatabase::TrustBits trust_bits) {
147 return cert_db_.SetCertTrust(cert, type, trust_bits); 145 return cert_db_.SetCertTrust(cert, type, trust_bits);
148 } 146 }
149 147
150 bool CertificateManagerModel::Delete(net::X509Certificate* cert) { 148 bool CertificateManagerModel::Delete(net::X509Certificate* cert) {
151 bool result = cert_db_.DeleteCertAndKey(cert); 149 bool result = cert_db_.DeleteCertAndKey(cert);
152 if (result) 150 if (result)
153 Refresh(); 151 Refresh();
154 return result; 152 return result;
155 } 153 }
154
155 bool CertificateManagerModel::IsHardwareBacked(
156 const net::X509Certificate* cert) const {
157 #if defined(OS_CHROMEOS)
158 return crypto::IsTPMTokenReady() &&
159 cert->os_cert_handle()->slot ==
160 cert_db().GetPrivateModule()->os_module_handle();
161 #else
162 return false;
163 #endif
164 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698