Closed
Description
Many base64 decoding libraries expect the encoded string to be padded with one or two "=" characters so that the length is a multiple of 4, as given by the following sample code in https://tools.ietf.org/html/draft-ietf-jose-json-web-signature-08#appendix-C
static byte [] base64urldecode(string arg)
{
string s = arg;
s = s.Replace('-', '+'); // 62nd char of encoding
s = s.Replace('_', '/'); // 63rd char of encoding
switch (s.Length % 4) // Pad with trailing '='s
{
case 0: break; // No pad chars in this case
case 2: s += "=="; break; // Two pad chars
case 3: s += "="; break; // One pad char
default: throw new System.Exception(
"Illegal base64url string!");
}
return Convert.FromBase64String(s); // Standard base64 decoder
}
Can we have an option for byte-transforms/encode :base64
to include this padding?
Metadata
Metadata
Assignees
Labels
No labels