| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 REMOTING_HOST_HOST_KEY_PAIR_H_ | 5 #ifndef REMOTING_HOST_HOST_KEY_PAIR_H_ |
| 6 #define REMOTING_HOST_HOST_KEY_PAIR_H_ | 6 #define REMOTING_HOST_HOST_KEY_PAIR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/task.h" | 12 #include "base/task.h" |
| 13 | 13 |
| 14 namespace base { | 14 namespace crypto { |
| 15 class RSAPrivateKey; | 15 class RSAPrivateKey; |
| 16 } // namespace base | 16 } // namespace base |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 class X509Certificate; | 19 class X509Certificate; |
| 20 } // namespace net | 20 } // namespace net |
| 21 | 21 |
| 22 namespace remoting { | 22 namespace remoting { |
| 23 | 23 |
| 24 class HostConfig; | 24 class HostConfig; |
| 25 class MutableHostConfig; | 25 class MutableHostConfig; |
| 26 | 26 |
| 27 class HostKeyPair { | 27 class HostKeyPair { |
| 28 public: | 28 public: |
| 29 HostKeyPair(); | 29 HostKeyPair(); |
| 30 ~HostKeyPair(); | 30 ~HostKeyPair(); |
| 31 | 31 |
| 32 void Generate(); | 32 void Generate(); |
| 33 bool LoadFromString(const std::string& key_base64); | 33 bool LoadFromString(const std::string& key_base64); |
| 34 bool Load(HostConfig* host_config); | 34 bool Load(HostConfig* host_config); |
| 35 void Save(MutableHostConfig* host_config); | 35 void Save(MutableHostConfig* host_config); |
| 36 | 36 |
| 37 std::string GetPublicKey() const; | 37 std::string GetPublicKey() const; |
| 38 std::string GetSignature(const std::string& message) const; | 38 std::string GetSignature(const std::string& message) const; |
| 39 | 39 |
| 40 // Make a new copy of private key. Caller will own the generated private key. | 40 // Make a new copy of private key. Caller will own the generated private key. |
| 41 base::RSAPrivateKey* CopyPrivateKey() const; | 41 crypto::RSAPrivateKey* CopyPrivateKey() const; |
| 42 net::X509Certificate* GenerateCertificate() const; | 42 net::X509Certificate* GenerateCertificate() const; |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 scoped_ptr<base::RSAPrivateKey> key_; | 45 scoped_ptr<crypto::RSAPrivateKey> key_; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 } // namespace remoting | 48 } // namespace remoting |
| 49 | 49 |
| 50 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::HostKeyPair); | 50 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::HostKeyPair); |
| 51 | 51 |
| 52 #endif // REMOTING_HOST_HOST_KEY_PAIR_H_ | 52 #endif // REMOTING_HOST_HOST_KEY_PAIR_H_ |
| OLD | NEW |