https://web.archive.org/web/20110422225659/https://en.wikipedia.org/wiki/Base64#URL_applications
talks about base64Url - Decode
a modified Base64 for URL variant exists, where no padding '=' will be used, and the '+' and '/' characters of standard Base64 are respectively replaced by '-' and '_'
I created the following function:
public static String base64UrlDecode(String input) { String result = null; BASE64Decoder decoder = new BASE64Decoder(); try { result = decoder.decodeBuffer(input.replace('-','+').replace('/','_')).toString(); } catch (IOException e) { System.out.println(e.getMessage()); } return result; }
it returns a very small set of characters that don't even resemble to the expected results. any ideas?
base64url.com Base64 is a group of similar binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. The term Base64 originates from a specific MIME content transfer encoding. Each base64 digit represents exactly 6 bits of data.
What is Base64? Base64 is a binary-to-text encoding scheme that represents binary data in a printable ASCII string format by translating it into a radix-64 representation. Each Base64 digit represents exactly 6 bits of binary data.
Base64URL Decode is a free online tool for decoding Base64URL values to original data. By default, it decodes Base64URL as plain text, nevertheless, it also supports binary data, such as images or other files.
You can encrypt and decrypt your data by using provided methods. You need to import java. util. Base64 in your source file to use its methods. This class provides three different encoders and decoders to encrypt information at each level.
Java8+
import java.util.Base64; return Base64.getUrlEncoder().encodeToString(bytes);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With