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

Unified Diff: remoting/host/gnubby_utils.h

Issue 138753005: Add gnubby authentication to remoting host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change authorization socket flag name Created 6 years, 10 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/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_

Powered by Google App Engine
This is Rietveld 408576698