Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_PROXIMITY_BASE64URL_H | 5 #ifndef COMPONENTS_PROXIMITY_BASE64URL_H |
| 6 #define COMPONENTS_PROXIMITY_BASE64URL_H | 6 #define COMPONENTS_PROXIMITY_BASE64URL_H |
|
Ilya Sherman
2015/04/08 18:24:32
nit: Please update the header guard.
Tim Song
2015/04/08 21:31:38
Done.
| |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 namespace proximity_auth { | 10 namespace proximity_auth { |
| 11 | 11 |
| 12 // An implmentation of the base64url encoding. Escapes the unsafe '+' and '/' | 12 // An implmentation of the base64url encoding. Escapes the unsafe '+' and '/' |
| 13 // characters with the url-safe alternatives '-' and '_', respectively. For more | 13 // characters with the url-safe alternatives '-' and '_', respectively. For more |
| 14 // info, see the section on "Base 64 Encoding with URL and Filename Safe | 14 // info, see the section on "Base 64 Encoding with URL and Filename Safe |
| 15 // Alphabet" in http://www.ietf.org/rfc/rfc4648.txt | 15 // Alphabet" in http://www.ietf.org/rfc/rfc4648.txt |
| 16 // NOTE: Unlike many common web-safe encodings, this function does not escape | 16 // NOTE: Unlike many common web-safe encodings, this function does not escape |
| 17 // the '=' character. This is to match the expectations set by Android. | 17 // the '=' character. This is to match the expectations set by Android. |
| 18 // TODO(isherman): There are several (semantically slightly different) | 18 // TODO(isherman): There are several (semantically slightly different) |
| 19 // implementations of this within the Chromium codebase. Try to unify them. | 19 // implementations of this within the Chromium codebase. Try to unify them. |
| 20 void Base64UrlEncode(const std::string& decoded_input, | 20 void Base64UrlEncode(const std::string& decoded_input, |
| 21 std::string* encoded_output); | 21 std::string* encoded_output); |
| 22 | 22 |
| 23 // The inverse operation for the base64url encoding above. | 23 // The inverse operation for the base64url encoding above. |
| 24 bool Base64UrlDecode(const std::string& encoded_input, | 24 bool Base64UrlDecode(const std::string& encoded_input, |
| 25 std::string* decoded_output); | 25 std::string* decoded_output); |
| 26 | 26 |
| 27 } // namespace proximity_auth | 27 } // namespace proximity_auth |
| 28 | 28 |
| 29 #endif // COMPONENTS_PROXIMITY_BASE64URL_H | 29 #endif // COMPONENTS_PROXIMITY_BASE64URL_H |
| OLD | NEW |