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

Unified Diff: remoting/host/host_key_pair.h

Issue 3087003: Added HostKeyPair class, signatures for heartbeat messages. (Closed)
Patch Set: Addressed review comments in the test Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: remoting/host/host_key_pair.h
diff --git a/remoting/host/host_key_pair.h b/remoting/host/host_key_pair.h
new file mode 100644
index 0000000000000000000000000000000000000000..eafec77926fd67790f714f4238a9110390ece4fb
--- /dev/null
+++ b/remoting/host/host_key_pair.h
@@ -0,0 +1,44 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_HOST_HOST_KEY_PAIR_H_
+#define REMOTING_HOST_HOST_KEY_PAIR_H_
+
+#include <vector>
+#include <string>
+
+#include "base/ref_counted.h"
+#include "base/scoped_ptr.h"
+
+namespace base {
+class RSAPrivateKey;
+}
awong 2010/08/02 19:53:49 namespace :P
Sergey Ulanov 2010/08/03 02:10:39 Done.
+
+namespace remoting {
+
+class HostConfig;
+class MutableHostConfig;
+
+class HostKeyPair : public base::RefCountedThreadSafe<HostKeyPair> {
awong 2010/08/02 19:53:49 Does this thing really need to be refcounted? Do
Sergey Ulanov 2010/08/03 02:10:39 The only reason it needs to be ref-counted is beca
awong 2010/08/03 19:21:02 Ah! we solved that! See the DISABLE_RUNNABLE_MET
+ public:
+ HostKeyPair();
+ virtual ~HostKeyPair();
awong 2010/08/02 19:53:49 The HearbeatSender class didn't have a virtual des
Sergey Ulanov 2010/08/03 02:10:39 removed it.
+
+ void Generate();
+ bool LoadFromString(const std::string& key_base64);
+ bool Load(HostConfig* host_config);
+ void Save(MutableHostConfig* host_config);
+
+ std::string GetPublicKey() const;
+ std::string GetSignature(const std::string& message) const;
+
+ private:
+ void DoSave(MutableHostConfig* host_config) const;
+
+ scoped_ptr<base::RSAPrivateKey> key_;
+};
+
+} // namespace remoting
+
+#endif // REMOTING_HOST_HOST_KEY_PAIR_H_

Powered by Google App Engine
This is Rietveld 408576698