The following errata report has been rejected for RFC7515, "JSON Web Signature (JWS)"
-------------------------------------- You may review the report below and at: https://errata.rfc-editor.org/eid9334/ -------------------------------------- Status: Rejected Type: Technical Reported by: Laszlo Deak <[email protected]> Date Reported: Nov. 24, 2026, 6:42 p.m. Rejected by: Deb Cooley (IESG) Section Appendix C. Notes on Implementing base64url Encoding without Padding says: Original Text ------------- This appendix describes how to implement base64url encoding and decoding functions without padding based upon standard base64 encoding and decoding functions that do use padding. To be concrete, example C# code implementing these functions is shown below. Similar code could be used in other languages. static string base64urlencode(byte [] arg) { string s = Convert.ToBase64String(arg); // Regular base64 encoder s = s.Split('=')[0]; // Remove any trailing '='s s = s.Replace('+', '-'); // 62nd char of encoding s = s.Replace('/', '_'); // 63rd char of encoding return s; } 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 } As per the example code above, the number of '=' padding characters that needs to be added to the end of a base64url-encoded string without padding to turn it into one with padding is a deterministic function of the length of the encoded string. Specifically, if the length mod 4 is 0, no padding is added; if the length mod 4 is 2, two '=' padding characters are added; if the length mod 4 is 3, one '=' padding character is added; if the length mod 4 is 1, the input is malformed. An example correspondence between unencoded and encoded values follows. The octet sequence below encodes into the string below, which when decoded, reproduces the octet sequence. 3 236 255 224 193 A-z_4ME Corrected Text -------------- This appendix describes how to implement base64url encoding and decoding functions without padding based upon standard base64 encoding and decoding functions that do use padding. To be concrete, example C# code implementing these functions is shown below. Similar code could be used in other languages. static string Base64UrlEncode(byte[] arg) => Base64Url.EncodeToString(arg); static byte[] Base64UrlDecode(string arg) => Base64Url.DecodeFromChars(arg); An example correspondence between unencoded and encoded values follows. The octet sequence below encodes into the string below, which when decoded, reproduces the octet sequence. 3 236 255 224 193 A-z_4ME Notes ----- Although effective for demonstrating the underlying steps, the original example is neither idiomatic C# nor production-ready, as it incurs excessive memory allocations and multiple iterations over the input. Given native Base64Url support in C# and most modern languages, the example has been updated to a cleaner, more efficient implementation. -------------------------------------- RFC7515 (draft-ietf-jose-json-web-signature) -------------------------------------- Title : JSON Web Signature (JWS) Publication Date : May 2015 Author(s) : M. Jones, J. Bradley, N. Sakimura Category : Proposed Standard Source : jose (sec) Stream : IETF _______________________________________________ jose mailing list -- [email protected] To unsubscribe send an email to [email protected]
