01: package org.bouncycastle.util.encoders;
02:
03: /**
04: * Convert binary data to and from UrlBase64 encoding. This is identical to
05: * Base64 encoding, except that the padding character is "." and the other
06: * non-alphanumeric characters are "-" and "_" instead of "+" and "/".
07: * <p>
08: * The purpose of UrlBase64 encoding is to provide a compact encoding of binary
09: * data that is safe for use as an URL parameter. Base64 encoding does not
10: * produce encoded values that are safe for use in URLs, since "/" can be
11: * interpreted as a path delimiter; "+" is the encoded form of a space; and
12: * "=" is used to separate a name from the corresponding value in an URL
13: * parameter.
14: */
15: public class UrlBase64Encoder extends Base64Encoder {
16: public UrlBase64Encoder() {
17: encodingTable[encodingTable.length - 2] = (byte) '-';
18: encodingTable[encodingTable.length - 1] = (byte) '_';
19: padding = (byte) '.';
20: // we must re-create the decoding table with the new encoded values.
21: initialiseDecodingTable();
22: }
23: }
|