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

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

Issue 7111014: [ChromeOS] Add a "hardware-backed" suffix to tpm-backed cert. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/callback_old.h" 7 #include "base/callback_old.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"
11 #include "chrome/browser/ui/crypto_module_password_dialog.h" 11 #include "chrome/browser/ui/crypto_module_password_dialog.h"
12 #include "chrome/common/net/x509_certificate_model.h" 12 #include "chrome/common/net/x509_certificate_model.h"
13 #include "net/base/crypto_module.h" 13 #include "net/base/crypto_module.h"
14 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
15 #include "net/base/x509_certificate.h" 15 #include "net/base/x509_certificate.h"
16 16
17 #if defined(OS_CHROMEOS)
18 #include <pk11pub.h>
19
20 #include "crypto/nss_util.h"
21 #include "grit/generated_resources.h"
22 #include "net/base/x509_certificate.h"
23 #include "ui/base/l10n/l10n_util.h"
24 #endif
25
17 CertificateManagerModel::CertificateManagerModel(Observer* observer) 26 CertificateManagerModel::CertificateManagerModel(Observer* observer)
18 : observer_(observer) { 27 : observer_(observer) {
19 } 28 }
20 29
21 CertificateManagerModel::~CertificateManagerModel() { 30 CertificateManagerModel::~CertificateManagerModel() {
22 } 31 }
23 32
24 void CertificateManagerModel::Refresh() { 33 void CertificateManagerModel::Refresh() {
25 VLOG(1) << "refresh started"; 34 VLOG(1) << "refresh started";
26 net::CryptoModuleList modules; 35 net::CryptoModuleList modules;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 72 }
64 73
65 string16 CertificateManagerModel::GetColumnText( 74 string16 CertificateManagerModel::GetColumnText(
66 const net::X509Certificate& cert, 75 const net::X509Certificate& cert,
67 Column column) const { 76 Column column) const {
68 string16 rv; 77 string16 rv;
69 switch (column) { 78 switch (column) {
70 case COL_SUBJECT_NAME: 79 case COL_SUBJECT_NAME:
71 rv = UTF8ToUTF16( 80 rv = UTF8ToUTF16(
72 x509_certificate_model::GetCertNameOrNickname(cert.os_cert_handle())); 81 x509_certificate_model::GetCertNameOrNickname(cert.os_cert_handle()));
82
83 #if defined(OS_CHROMEOS)
84 // TODO(xiyuan): Put this into a column when we have js tree-table.
85 if (crypto::IsTPMTokenReady()) {
86 std::string tpm_token_name;
87 std::string user_pin;
88 crypto::GetTPMTokenInfo(&tpm_token_name, &user_pin);
89
90 PK11SlotInfo* cert_slot = cert.os_cert_handle()->slot;
91 if (cert_slot && PK11_GetTokenName(cert_slot) == tpm_token_name) {
mattm 2011/06/04 02:00:32 If we want to do it by comparing the name, it coul
xiyuan 2011/06/06 17:17:17 This is what I want to hear. I'd like to compare h
92 rv = l10n_util::GetStringFUTF16(
93 IDS_CERT_MANAGER_HARDWARE_BACKED_KEY_FORMAT,
94 rv,
95 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_HARDWARE_BACKED));
96 }
97 }
98 #endif
73 break; 99 break;
74 case COL_CERTIFICATE_STORE: 100 case COL_CERTIFICATE_STORE:
75 rv = UTF8ToUTF16( 101 rv = UTF8ToUTF16(
76 x509_certificate_model::GetTokenName(cert.os_cert_handle())); 102 x509_certificate_model::GetTokenName(cert.os_cert_handle()));
77 break; 103 break;
78 case COL_SERIAL_NUMBER: 104 case COL_SERIAL_NUMBER:
79 rv = ASCIIToUTF16( 105 rv = ASCIIToUTF16(
80 x509_certificate_model::GetSerialNumberHexified( 106 x509_certificate_model::GetSerialNumberHexified(
81 cert.os_cert_handle(), "")); 107 cert.os_cert_handle(), ""));
82 break; 108 break;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 unsigned int trust_bits) { 149 unsigned int trust_bits) {
124 return cert_db_.SetCertTrust(cert, type, trust_bits); 150 return cert_db_.SetCertTrust(cert, type, trust_bits);
125 } 151 }
126 152
127 bool CertificateManagerModel::Delete(net::X509Certificate* cert) { 153 bool CertificateManagerModel::Delete(net::X509Certificate* cert) {
128 bool result = cert_db_.DeleteCertAndKey(cert); 154 bool result = cert_db_.DeleteCertAndKey(cert);
129 if (result) 155 if (result)
130 Refresh(); 156 Refresh();
131 return result; 157 return result;
132 } 158 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698