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

Side by Side Diff: chrome/browser/chromeos/settings/mock_owner_key_util.cc

Issue 494093002: OwnerKeyUtil is moved to components/ownership. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed GYP file. Created 6 years, 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/settings/mock_owner_key_util.h"
6
7 #include "crypto/rsa_private_key.h"
8
9 namespace chromeos {
10
11 MockOwnerKeyUtil::MockOwnerKeyUtil() {}
12
13 MockOwnerKeyUtil::~MockOwnerKeyUtil() {}
14
15 bool MockOwnerKeyUtil::ImportPublicKey(std::vector<uint8>* output) {
16 *output = public_key_;
17 return !public_key_.empty();
18 }
19
20 crypto::RSAPrivateKey* MockOwnerKeyUtil::FindPrivateKeyInSlot(
21 const std::vector<uint8>& key,
22 PK11SlotInfo* slot) {
23 return private_key_.get() ? private_key_->Copy() : NULL;
24 }
25
26 bool MockOwnerKeyUtil::IsPublicKeyPresent() {
27 return !public_key_.empty();
28 }
29
30 void MockOwnerKeyUtil::Clear() {
31 public_key_.clear();
32 private_key_.reset();
33 }
34
35 void MockOwnerKeyUtil::SetPublicKey(const std::vector<uint8>& key) {
36 public_key_ = key;
37 }
38
39 void MockOwnerKeyUtil::SetPublicKeyFromPrivateKey(
40 const crypto::RSAPrivateKey& key) {
41 key.ExportPublicKey(&public_key_);
42 }
43
44 void MockOwnerKeyUtil::SetPrivateKey(scoped_ptr<crypto::RSAPrivateKey> key) {
45 private_key_ = key.Pass();
46 private_key_->ExportPublicKey(&public_key_);
47 }
48
49 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/settings/mock_owner_key_util.h ('k') | chrome/browser/chromeos/settings/owner_key_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698