Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / chromeos / settings / mock_owner_key_util.cc
blob1f7754569f6e42c316fec0ae8b3daff9da3d7564
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.
5 #include "chrome/browser/chromeos/settings/mock_owner_key_util.h"
7 #include "crypto/rsa_private_key.h"
9 namespace chromeos {
11 MockOwnerKeyUtil::MockOwnerKeyUtil() {}
13 MockOwnerKeyUtil::~MockOwnerKeyUtil() {}
15 bool MockOwnerKeyUtil::ImportPublicKey(std::vector<uint8>* output) {
16 *output = public_key_;
17 return !public_key_.empty();
20 crypto::RSAPrivateKey* MockOwnerKeyUtil::FindPrivateKey(
21 const std::vector<uint8>& key) {
22 return private_key_.get() ? private_key_->Copy() : NULL;
25 bool MockOwnerKeyUtil::IsPublicKeyPresent() {
26 return !public_key_.empty();
29 void MockOwnerKeyUtil::Clear() {
30 public_key_.clear();
31 private_key_.reset();
34 void MockOwnerKeyUtil::SetPublicKey(const std::vector<uint8>& key) {
35 public_key_ = key;
38 void MockOwnerKeyUtil::SetPublicKeyFromPrivateKey(
39 const crypto::RSAPrivateKey& key) {
40 key.ExportPublicKey(&public_key_);
43 void MockOwnerKeyUtil::SetPrivateKey(scoped_ptr<crypto::RSAPrivateKey> key) {
44 private_key_ = key.Pass();
45 private_key_->ExportPublicKey(&public_key_);
48 } // namespace chromeos