Index: components/gcm_driver/crypto/encryption_header_parsers.cc |
diff --git a/components/gcm_driver/crypto/encryption_header_parsers.cc b/components/gcm_driver/crypto/encryption_header_parsers.cc |
index 6a45792e85b04f480f1d095be40768f067306294..f320a101e69043554086d0d4c098085dad6b587a 100644 |
--- a/components/gcm_driver/crypto/encryption_header_parsers.cc |
+++ b/components/gcm_driver/crypto/encryption_header_parsers.cc |
@@ -56,24 +56,6 @@ bool ParseMultipleNameValueListsHeader(const std::string& input, |
return true; |
} |
-// TODO(peter): Generalize a base64url implementation. |
-// See https://tools.ietf.org/html/rfc4648#section-5 |
-bool Base64DecodeUrlSafe(const std::string& input, std::string* output) { |
- if (input.find_first_of("+/") != std::string::npos) |
- return false; |
- |
- // Add padding. |
- size_t padded_size = (input.size() + 3) - (input.size() + 3) % 4; |
- std::string padded_input(input); |
- padded_input.resize(padded_size, '='); |
- |
- // Convert to standard base64 alphabet. |
- base::ReplaceChars(padded_input, "-", "+", &padded_input); |
- base::ReplaceChars(padded_input, "_", "/", &padded_input); |
- |
- return base::Base64Decode(padded_input, output); |
-} |
- |
// Parses the "salt" field of the Encryption header. Must be a base64url |
// encoded string that decodes to a string exactly 16 bytes in length. |
bool ParseSalt(const std::string& value, std::string* output) { |
@@ -196,4 +178,22 @@ bool ParseEncryptionKeyHeader(const std::string& input, |
return true; |
} |
+// TODO(peter): Generalize a base64url implementation. |
+// See https://tools.ietf.org/html/rfc4648#section-5 |
+bool Base64DecodeUrlSafe(const std::string& input, std::string* output) { |
+ if (input.find_first_of("+/") != std::string::npos) |
+ return false; |
+ |
+ // Add padding. |
+ size_t padded_size = (input.size() + 3) - (input.size() + 3) % 4; |
+ std::string padded_input(input); |
+ padded_input.resize(padded_size, '='); |
+ |
+ // Convert to standard base64 alphabet. |
+ base::ReplaceChars(padded_input, "-", "+", &padded_input); |
+ base::ReplaceChars(padded_input, "_", "/", &padded_input); |
+ |
+ return base::Base64Decode(padded_input, output); |
+} |
+ |
} // namespace gcm |