I'm looking for a (fast) standard implementation for base64url according to RFC4648 in C#.
I found HttpServerUtility.UrlTokenEncode
but it looks like this doesn't follow RFC4648 (UrlTokenEncode adds a number at the end which indicates the number of =
signs that were removed; see here and here).
Example:
base64 encoding:
Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes("AA")); //returns "QUE="
base64url encoding:
HttpServerUtility.UrlTokenEncode(System.Text.Encoding.ASCII.GetBytes("AA")); //returns "QUE1" but I would expect "QUE"
Substring
. Anything wrong with that? – Bilbao