| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 LOGIN_MANAGER_OWNER_KEY_H_ | 5 #ifndef LOGIN_MANAGER_OWNER_KEY_H_ |
| 6 #define LOGIN_MANAGER_OWNER_KEY_H_ | 6 #define LOGIN_MANAGER_OWNER_KEY_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include <base/basictypes.h> | 10 #include <base/basictypes.h> |
| 11 #include <base/file_path.h> | 11 #include <base/file_path.h> |
| 12 #include <base/scoped_ptr.h> | 12 #include <base/scoped_ptr.h> |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 class RSAPrivateKey; | 15 class RSAPrivateKey; |
| 16 class SignatureVerifier; | 16 class SignatureVerifier; |
| 17 } // namespace base | 17 } // namespace base |
| 18 | 18 |
| 19 namespace login_manager { | 19 namespace login_manager { |
| 20 class ChildJobInterface; |
| 20 class SystemUtils; | 21 class SystemUtils; |
| 21 | 22 |
| 22 // This class holds the device owner's public key. | 23 // This class holds the device owner's public key. |
| 23 // | 24 // |
| 24 // If there is an owner key on disk, we will load that key, and deny | 25 // If there is an owner key on disk, we will load that key, and deny |
| 25 // attempts to set a new key programmatically. If there is no key | 26 // attempts to set a new key programmatically. If there is no key |
| 26 // present, we will allow the owner's key to be set programmatically, | 27 // present, we will allow the owner's key to be set programmatically, |
| 27 // and will persist it to disk upon request. Attempts to set the key | 28 // and will persist it to disk upon request. Attempts to set the key |
| 28 // before on-disk storage has been checked will be denied. | 29 // before on-disk storage has been checked will be denied. |
| 29 class OwnerKey { | 30 class OwnerKey { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 const char* signature, | 66 const char* signature, |
| 66 uint32 sig_len); | 67 uint32 sig_len); |
| 67 | 68 |
| 68 // Generate |OUT_signature|, a valid sha1 w/ RSA signature over the data in | 69 // Generate |OUT_signature|, a valid sha1 w/ RSA signature over the data in |
| 69 // |data| that can be verified with |key_|. | 70 // |data| that can be verified with |key_|. |
| 70 // Returns false if the sig is invalid, or there's an error. | 71 // Returns false if the sig is invalid, or there's an error. |
| 71 virtual bool Sign(const char* data, | 72 virtual bool Sign(const char* data, |
| 72 uint32 data_len, | 73 uint32 data_len, |
| 73 std::vector<uint8>* OUT_signature); | 74 std::vector<uint8>* OUT_signature); |
| 74 | 75 |
| 76 // Runs |generator| in a child process. Returns pid of the child. |
| 77 virtual int StartGeneration(ChildJobInterface* generator); |
| 78 |
| 75 // Returned reference will be empty if we haven't populated |key_| yet. | 79 // Returned reference will be empty if we haven't populated |key_| yet. |
| 76 const std::vector<uint8>& public_key_der() const { | 80 const std::vector<uint8>& public_key_der() const { |
| 77 return key_; | 81 return key_; |
| 78 } | 82 } |
| 79 | 83 |
| 80 private: | 84 private: |
| 81 static const uint8 kAlgorithm[]; | 85 static const uint8 kAlgorithm[]; |
| 82 | 86 |
| 83 const FilePath key_file_; | 87 const FilePath key_file_; |
| 84 bool have_checked_disk_; | 88 bool have_checked_disk_; |
| 85 std::vector<uint8> key_; | 89 std::vector<uint8> key_; |
| 86 scoped_ptr<SystemUtils> utils_; | 90 scoped_ptr<SystemUtils> utils_; |
| 87 | 91 |
| 88 DISALLOW_COPY_AND_ASSIGN(OwnerKey); | 92 DISALLOW_COPY_AND_ASSIGN(OwnerKey); |
| 89 }; | 93 }; |
| 90 } // namespace login_manager | 94 } // namespace login_manager |
| 91 | 95 |
| 92 #endif // LOGIN_MANAGER_OWNER_KEY_H_ | 96 #endif // LOGIN_MANAGER_OWNER_KEY_H_ |
| OLD | NEW |