OLD | NEW |
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/chromeos/login/owner_key_utils.h" | 5 #include "chrome/browser/chromeos/login/owner_key_utils.h" |
6 | 6 |
7 #include <keyhi.h> // SECKEY_CreateSubjectPublicKeyInfo() | 7 #include <keyhi.h> // SECKEY_CreateSubjectPublicKeyInfo() |
8 #include <pk11pub.h> | 8 #include <pk11pub.h> |
9 #include <prerror.h> // PR_GetError() | 9 #include <prerror.h> // PR_GetError() |
10 #include <secder.h> // DER_Encode() | 10 #include <secder.h> // DER_Encode() |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 DCHECK(pair); | 116 DCHECK(pair); |
117 bool ok = false; | 117 bool ok = false; |
118 | 118 |
119 std::vector<uint8> to_export; | 119 std::vector<uint8> to_export; |
120 if (!pair->ExportPublicKey(&to_export)) { | 120 if (!pair->ExportPublicKey(&to_export)) { |
121 LOG(ERROR) << "Formatting key for export via dbus failed!"; | 121 LOG(ERROR) << "Formatting key for export via dbus failed!"; |
122 return false; | 122 return false; |
123 } | 123 } |
124 | 124 |
125 if (CrosLibrary::Get()->EnsureLoaded()) | 125 if (CrosLibrary::Get()->EnsureLoaded()) |
126 ok = CrosLibrary::Get()->GetLoginLibrary()->SetOwnerKey(to_export, d); | 126 ok = CrosLibrary::Get()->GetLoginLibrary()->SetOwnerKeyAsync(to_export, d); |
127 | 127 |
128 return ok; | 128 return ok; |
129 } | 129 } |
130 | 130 |
131 bool OwnerKeyUtilsImpl::ExportPublicKeyToFile(RSAPrivateKey* pair, | 131 bool OwnerKeyUtilsImpl::ExportPublicKeyToFile(RSAPrivateKey* pair, |
132 const FilePath& key_file) { | 132 const FilePath& key_file) { |
133 DCHECK(pair); | 133 DCHECK(pair); |
134 bool ok = false; | 134 bool ok = false; |
135 int safe_file_size = 0; | 135 int safe_file_size = 0; |
136 | 136 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 RSAPrivateKey* OwnerKeyUtilsImpl::FindPrivateKey( | 206 RSAPrivateKey* OwnerKeyUtilsImpl::FindPrivateKey( |
207 const std::vector<uint8>& key) { | 207 const std::vector<uint8>& key) { |
208 return RSAPrivateKey::FindFromPublicKeyInfo(key); | 208 return RSAPrivateKey::FindFromPublicKeyInfo(key); |
209 } | 209 } |
210 | 210 |
211 FilePath OwnerKeyUtilsImpl::GetOwnerKeyFilePath() { | 211 FilePath OwnerKeyUtilsImpl::GetOwnerKeyFilePath() { |
212 return FilePath(OwnerKeyUtilsImpl::kOwnerKeyFile); | 212 return FilePath(OwnerKeyUtilsImpl::kOwnerKeyFile); |
213 } | 213 } |
214 | 214 |
215 } // namespace chromeos | 215 } // namespace chromeos |
OLD | NEW |