Index: remoting/host/gnubby_utils.h |
diff --git a/remoting/host/gnubby_utils.h b/remoting/host/gnubby_utils.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b988d0326272ff5f5720256682cdaecf8ecb6412 |
--- /dev/null |
+++ b/remoting/host/gnubby_utils.h |
@@ -0,0 +1,55 @@ |
+// Copyright 2014 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_GNUBBY_UTILS_H_ |
+#define REMOTING_HOST_GNUBBY_UTILS_H_ |
+ |
+#include <string> |
+ |
+#include "base/basictypes.h" |
+ |
+namespace base { |
+ |
+class DictionaryValue; |
+ |
+} // namespace base |
+ |
+namespace remoting { |
+ |
+// Utility methods for gnubby processing. |
+ |
+class GnubbyUtils { |
+ public: |
+ // Get a gnubbyd sign request json string from a request blob. |
+ static bool GetJsonFromRequest(const char* data, |
+ int data_len, |
+ std::string* json); |
+ |
+ // Get response blob data from a gnubbyd sign reply json string. |
+ static void GetResponseFromJson(std::string json, std::string* data); |
Sergey Ulanov
2014/02/09 22:29:54
const-ref for the first argument please.
psj
2014/02/10 22:57:22
Done.
|
+ |
+ private: |
+ // No construction - all methods are static. |
Sergey Ulanov
2014/02/09 22:29:54
Don't really need a class in this case - just decl
psj
2014/02/10 22:57:22
Done.
|
+ GnubbyUtils(); |
+ |
+ // Create a "web safe" base64 encoding of |data|. Replaces + with -, / with _ |
+ // and strips trailing = characters. |
+ static void WebSafeBase64Encode(const std::string& data, |
Sergey Ulanov
2014/02/09 22:29:54
Since these are all private they don't need to be
psj
2014/02/10 22:57:22
Done.
|
+ std::string* encoded_data); |
+ |
+ // Decode a "web safe" base64 encoded string. |
+ static void WebSafeBase64Decode(const std::string& encoded_data, |
+ std::string* data); |
+ |
+ // Get and decode a "web safe" base64 encoded string from a JSON dictionary. |
+ static bool DecodeDataFromDictionary(const base::DictionaryValue& dictionary, |
+ const std::string& path, |
+ std::string* data); |
+ |
+ DISALLOW_COPY_AND_ASSIGN(GnubbyUtils); |
+}; |
+ |
+} // namespace remoting |
+ |
+#endif // REMOTING_HOST_GNUBBY_UTILS_H_ |