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

Side by Side Diff: components/ownership/mock_owner_key_util.cc

Issue 1921923002: Convert //components/[o-t]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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
« no previous file with comments | « components/ownership/mock_owner_key_util.h ('k') | components/ownership/owner_key_util.h » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 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 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 "components/ownership/mock_owner_key_util.h" 5 #include "components/ownership/mock_owner_key_util.h"
6 6
7 #include <pk11pub.h> 7 #include <pk11pub.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 void MockOwnerKeyUtil::SetPublicKey(const std::vector<uint8_t>& key) { 46 void MockOwnerKeyUtil::SetPublicKey(const std::vector<uint8_t>& key) {
47 public_key_ = key; 47 public_key_ = key;
48 } 48 }
49 49
50 void MockOwnerKeyUtil::SetPublicKeyFromPrivateKey( 50 void MockOwnerKeyUtil::SetPublicKeyFromPrivateKey(
51 const crypto::RSAPrivateKey& key) { 51 const crypto::RSAPrivateKey& key) {
52 CHECK(key.ExportPublicKey(&public_key_)); 52 CHECK(key.ExportPublicKey(&public_key_));
53 } 53 }
54 54
55 void MockOwnerKeyUtil::SetPrivateKey(scoped_ptr<crypto::RSAPrivateKey> key) { 55 void MockOwnerKeyUtil::SetPrivateKey(
56 std::unique_ptr<crypto::RSAPrivateKey> key) {
56 crypto::EnsureNSSInit(); 57 crypto::EnsureNSSInit();
57 58
58 CHECK(key->ExportPublicKey(&public_key_)); 59 CHECK(key->ExportPublicKey(&public_key_));
59 60
60 std::vector<uint8_t> key_exported; 61 std::vector<uint8_t> key_exported;
61 CHECK(key->ExportPrivateKey(&key_exported)); 62 CHECK(key->ExportPrivateKey(&key_exported));
62 63
63 crypto::ScopedPK11Slot slot(PK11_GetInternalSlot()); 64 crypto::ScopedPK11Slot slot(PK11_GetInternalSlot());
64 CHECK(slot); 65 CHECK(slot);
65 private_key_ = crypto::ImportNSSKeyFromPrivateKeyInfo( 66 private_key_ = crypto::ImportNSSKeyFromPrivateKeyInfo(
66 slot.get(), key_exported, false /* not permanent */); 67 slot.get(), key_exported, false /* not permanent */);
67 CHECK(private_key_); 68 CHECK(private_key_);
68 } 69 }
69 70
70 } // namespace ownership 71 } // namespace ownership
OLDNEW
« no previous file with comments | « components/ownership/mock_owner_key_util.h ('k') | components/ownership/owner_key_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698