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

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

Issue 1082123003: Rename USE_NSS to USE_NSS_CERTS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@use-nss-certs
Patch Set: rebase Created 5 years, 8 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
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 #ifndef COMPONENTS_OWNERSHIP_MOCK_OWNER_KEY_UTIL_H_ 5 #ifndef COMPONENTS_OWNERSHIP_MOCK_OWNER_KEY_UTIL_H_
6 #define COMPONENTS_OWNERSHIP_MOCK_OWNER_KEY_UTIL_H_ 6 #define COMPONENTS_OWNERSHIP_MOCK_OWNER_KEY_UTIL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "components/ownership/owner_key_util.h" 14 #include "components/ownership/owner_key_util.h"
15 #include "components/ownership/ownership_export.h" 15 #include "components/ownership/ownership_export.h"
16 16
17 namespace ownership { 17 namespace ownership {
18 18
19 // Implementation of OwnerKeyUtil which should be used only for 19 // Implementation of OwnerKeyUtil which should be used only for
20 // testing. 20 // testing.
21 class OWNERSHIP_EXPORT MockOwnerKeyUtil : public OwnerKeyUtil { 21 class OWNERSHIP_EXPORT MockOwnerKeyUtil : public OwnerKeyUtil {
22 public: 22 public:
23 MockOwnerKeyUtil(); 23 MockOwnerKeyUtil();
24 24
25 // OwnerKeyUtil implementation: 25 // OwnerKeyUtil implementation:
26 bool ImportPublicKey(std::vector<uint8>* output) override; 26 bool ImportPublicKey(std::vector<uint8>* output) override;
27 #if defined(USE_NSS) 27 #if defined(USE_NSS_CERTS)
28 crypto::RSAPrivateKey* FindPrivateKeyInSlot(const std::vector<uint8>& key, 28 crypto::RSAPrivateKey* FindPrivateKeyInSlot(const std::vector<uint8>& key,
29 PK11SlotInfo* slot) override; 29 PK11SlotInfo* slot) override;
30 #endif // defined(USE_NSS) 30 #endif // defined(USE_NSS_CERTS)
31 bool IsPublicKeyPresent() override; 31 bool IsPublicKeyPresent() override;
32 32
33 // Clears the public and private keys. 33 // Clears the public and private keys.
34 void Clear(); 34 void Clear();
35 35
36 // Configures the mock to return the given public key. 36 // Configures the mock to return the given public key.
37 void SetPublicKey(const std::vector<uint8>& key); 37 void SetPublicKey(const std::vector<uint8>& key);
38 38
39 // Sets the public key to use from the given private key, but doesn't 39 // Sets the public key to use from the given private key, but doesn't
40 // configure the private key. 40 // configure the private key.
41 void SetPublicKeyFromPrivateKey(const crypto::RSAPrivateKey& key); 41 void SetPublicKeyFromPrivateKey(const crypto::RSAPrivateKey& key);
42 42
43 // Sets the private key (also configures the public key). 43 // Sets the private key (also configures the public key).
44 void SetPrivateKey(scoped_ptr<crypto::RSAPrivateKey> key); 44 void SetPrivateKey(scoped_ptr<crypto::RSAPrivateKey> key);
45 45
46 private: 46 private:
47 ~MockOwnerKeyUtil() override; 47 ~MockOwnerKeyUtil() override;
48 48
49 std::vector<uint8> public_key_; 49 std::vector<uint8> public_key_;
50 scoped_ptr<crypto::RSAPrivateKey> private_key_; 50 scoped_ptr<crypto::RSAPrivateKey> private_key_;
51 51
52 DISALLOW_COPY_AND_ASSIGN(MockOwnerKeyUtil); 52 DISALLOW_COPY_AND_ASSIGN(MockOwnerKeyUtil);
53 }; 53 };
54 54
55 } // namespace ownership 55 } // namespace ownership
56 56
57 #endif // COMPONENTS_OWNERSHIP_MOCK_OWNER_KEY_UTIL_H_ 57 #endif // COMPONENTS_OWNERSHIP_MOCK_OWNER_KEY_UTIL_H_
OLDNEW
« no previous file with comments | « components/nacl/loader/nacl_validation_query.cc ('k') | components/ownership/mock_owner_key_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698