Package io.jans.lock.trace.crypto
Class StrictBase64Url
java.lang.Object
io.jans.lock.trace.crypto.StrictBase64Url
Strict base64url (RFC 4648 §5) codec without padding, as required by JWK
x members
(RFC 7517 / RFC 8037) and JWS signatures (RFC 7515 §2, "Base64url Encoding").
decode(String) accepts only the 64-character URL-safe alphabet, no padding, no
whitespace, a length of 0, 2 or 3 (mod 4), and only canonical encodings (the unused trailing
bits of the last character must be zero). Everything else is rejected with
IllegalArgumentException, unlike the lenient commons-codec based
io.jans.as.model.util.Base64Util.
- Author:
- Yuriy Movchan
-
Method Summary
-
Method Details
-
encode
- Returns:
- the unpadded base64url encoding of
bytes - Throws:
IllegalArgumentException- ifbytesis null
-
decode
- Returns:
- the decoded bytes; an empty string decodes to an empty array
- Throws:
IllegalArgumentException- ifsis null, contains a character outside[A-Za-z0-9_-](this includes padding and whitespace), has length 1 (mod 4), or is not the canonical encoding of its decoded value
-