| OLD | NEW |
| 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 CHROME_BROWSER_CHROMEOS_SETTINGS_OWNER_KEY_UTIL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_OWNER_KEY_UTIL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_OWNER_KEY_UTIL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_OWNER_KEY_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 | 16 |
| 17 namespace base { |
| 17 class FilePath; | 18 class FilePath; |
| 19 } |
| 18 | 20 |
| 19 namespace crypto { | 21 namespace crypto { |
| 20 class RSAPrivateKey; | 22 class RSAPrivateKey; |
| 21 } | 23 } |
| 22 | 24 |
| 23 namespace chromeos { | 25 namespace chromeos { |
| 24 | 26 |
| 25 class OwnerKeyUtilTest; | 27 class OwnerKeyUtilTest; |
| 26 | 28 |
| 27 class OwnerKeyUtil : public base::RefCountedThreadSafe<OwnerKeyUtil> { | 29 class OwnerKeyUtil : public base::RefCountedThreadSafe<OwnerKeyUtil> { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 52 FRIEND_TEST_ALL_PREFIXES(OwnerKeyUtilTest, ExportImportPublicKey); | 54 FRIEND_TEST_ALL_PREFIXES(OwnerKeyUtilTest, ExportImportPublicKey); |
| 53 }; | 55 }; |
| 54 | 56 |
| 55 // Implementation of OwnerKeyUtil that is used in production code. | 57 // Implementation of OwnerKeyUtil that is used in production code. |
| 56 class OwnerKeyUtilImpl : public OwnerKeyUtil { | 58 class OwnerKeyUtilImpl : public OwnerKeyUtil { |
| 57 public: | 59 public: |
| 58 // The file outside the owner's encrypted home directory where her | 60 // The file outside the owner's encrypted home directory where her |
| 59 // key will live. | 61 // key will live. |
| 60 static const char kOwnerKeyFile[]; | 62 static const char kOwnerKeyFile[]; |
| 61 | 63 |
| 62 explicit OwnerKeyUtilImpl(const FilePath& public_key_file); | 64 explicit OwnerKeyUtilImpl(const base::FilePath& public_key_file); |
| 63 | 65 |
| 64 // OwnerKeyUtil: | 66 // OwnerKeyUtil: |
| 65 virtual bool ImportPublicKey(std::vector<uint8>* output) OVERRIDE; | 67 virtual bool ImportPublicKey(std::vector<uint8>* output) OVERRIDE; |
| 66 virtual crypto::RSAPrivateKey* FindPrivateKey( | 68 virtual crypto::RSAPrivateKey* FindPrivateKey( |
| 67 const std::vector<uint8>& key) OVERRIDE; | 69 const std::vector<uint8>& key) OVERRIDE; |
| 68 virtual bool IsPublicKeyPresent() OVERRIDE; | 70 virtual bool IsPublicKeyPresent() OVERRIDE; |
| 69 | 71 |
| 70 protected: | 72 protected: |
| 71 virtual ~OwnerKeyUtilImpl(); | 73 virtual ~OwnerKeyUtilImpl(); |
| 72 | 74 |
| 73 private: | 75 private: |
| 74 // The file that holds the public key. | 76 // The file that holds the public key. |
| 75 FilePath key_file_; | 77 base::FilePath key_file_; |
| 76 | 78 |
| 77 DISALLOW_COPY_AND_ASSIGN(OwnerKeyUtilImpl); | 79 DISALLOW_COPY_AND_ASSIGN(OwnerKeyUtilImpl); |
| 78 }; | 80 }; |
| 79 | 81 |
| 80 } // namespace chromeos | 82 } // namespace chromeos |
| 81 | 83 |
| 82 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_OWNER_KEY_UTIL_H_ | 84 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_OWNER_KEY_UTIL_H_ |
| OLD | NEW |