Index: content/renderer/webcrypto/webcrypto_util.cc |
diff --git a/content/renderer/webcrypto/webcrypto_util.cc b/content/renderer/webcrypto/webcrypto_util.cc |
index 34bc92a9f73afcfb14f36bcac180c742aec8fdb0..7db402d8e88e35da3df15e27b48f2907c5b6f67b 100644 |
--- a/content/renderer/webcrypto/webcrypto_util.cc |
+++ b/content/renderer/webcrypto/webcrypto_util.cc |
@@ -49,6 +49,11 @@ void ShrinkBuffer(blink::WebArrayBuffer* buffer, unsigned new_size) { |
*buffer = new_buffer; |
} |
+// This function decodes unpadded 'base64url' encoded data, as described in |
+// RFC4648 (http://www.ietf.org/rfc/rfc4648.txt) Section 5. To do this, first |
+// change the incoming data to 'base64' encoding by applying the appropriate |
+// transformation including adding padding if required, and then call a base64 |
+// decoder. |
bool Base64DecodeUrlSafe(const std::string& input, std::string* output) { |
std::string base64EncodedText(input); |
std::replace(base64EncodedText.begin(), base64EncodedText.end(), '-', '+'); |