|
@@ -26,17 +26,17 @@ package org.dromara.maxkey.authz.oauth2.jwt.codec;
|
|
final class Base64Codec {
|
|
final class Base64Codec {
|
|
|
|
|
|
/** No options specified. Value is zero. */
|
|
/** No options specified. Value is zero. */
|
|
- public final static int NO_OPTIONS = 0;
|
|
|
|
|
|
+ public static final int NO_OPTIONS = 0;
|
|
|
|
|
|
/** Specify encoding in first bit. Value is one. */
|
|
/** Specify encoding in first bit. Value is one. */
|
|
- public final static int ENCODE = 1;
|
|
|
|
|
|
+ public static final int ENCODE = 1;
|
|
|
|
|
|
|
|
|
|
/** Specify decoding in first bit. Value is zero. */
|
|
/** Specify decoding in first bit. Value is zero. */
|
|
- public final static int DECODE = 0;
|
|
|
|
|
|
+ public static final int DECODE = 0;
|
|
|
|
|
|
/** Do break lines when encoding. Value is 8. */
|
|
/** Do break lines when encoding. Value is 8. */
|
|
- public final static int DO_BREAK_LINES = 8;
|
|
|
|
|
|
+ public static final int DO_BREAK_LINES = 8;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Encode using Base64-like encoding that is URL- and Filename-safe as described
|
|
* Encode using Base64-like encoding that is URL- and Filename-safe as described
|
|
@@ -46,36 +46,36 @@ final class Base64Codec {
|
|
* or at the very least should not be called Base64 without also specifying that is
|
|
* or at the very least should not be called Base64 without also specifying that is
|
|
* was encoded using the URL- and Filename-safe dialect.
|
|
* was encoded using the URL- and Filename-safe dialect.
|
|
*/
|
|
*/
|
|
- public final static int URL_SAFE = 16;
|
|
|
|
|
|
+ public static final int URL_SAFE = 16;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* Encode using the special "ordered" dialect of Base64 described here:
|
|
* Encode using the special "ordered" dialect of Base64 described here:
|
|
* <a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/qa/rfcc-1940.html</a>.
|
|
* <a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/qa/rfcc-1940.html</a>.
|
|
*/
|
|
*/
|
|
- public final static int ORDERED = 32;
|
|
|
|
|
|
+ public static final int ORDERED = 32;
|
|
|
|
|
|
|
|
|
|
/** Maximum line length (76) of Base64 output. */
|
|
/** Maximum line length (76) of Base64 output. */
|
|
- private final static int MAX_LINE_LENGTH = 76;
|
|
|
|
|
|
+ private static final int MAX_LINE_LENGTH = 76;
|
|
|
|
|
|
|
|
|
|
/** The equals sign (=) as a byte. */
|
|
/** The equals sign (=) as a byte. */
|
|
- private final static byte EQUALS_SIGN = (byte)'=';
|
|
|
|
|
|
+ private static final byte EQUALS_SIGN = (byte)'=';
|
|
|
|
|
|
|
|
|
|
/** The new line character (\n) as a byte. */
|
|
/** The new line character (\n) as a byte. */
|
|
- private final static byte NEW_LINE = (byte)'\n';
|
|
|
|
|
|
+ private static final byte NEW_LINE = (byte)'\n';
|
|
|
|
|
|
- private final static byte WHITE_SPACE_ENC = -5; // Indicates white space in encoding
|
|
|
|
- private final static byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding
|
|
|
|
|
|
+ private static final byte WHITE_SPACE_ENC = -5; // Indicates white space in encoding
|
|
|
|
+ private static final byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding
|
|
|
|
|
|
|
|
|
|
/* ******** S T A N D A R D B A S E 6 4 A L P H A B E T ******** */
|
|
/* ******** S T A N D A R D B A S E 6 4 A L P H A B E T ******** */
|
|
|
|
|
|
/** The 64 valid Base64 values. */
|
|
/** The 64 valid Base64 values. */
|
|
/* Host platform me be something funny like EBCDIC, so we hardcode these values. */
|
|
/* Host platform me be something funny like EBCDIC, so we hardcode these values. */
|
|
- private final static byte[] _STANDARD_ALPHABET = {
|
|
|
|
|
|
+ private static final byte[] _STANDARD_ALPHABET = {
|
|
(byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
|
|
(byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
|
|
(byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
|
|
(byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
|
|
(byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
|
|
(byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
|
|
@@ -93,7 +93,7 @@ final class Base64Codec {
|
|
* Translates a Base64 value to either its 6-bit reconstruction value
|
|
* Translates a Base64 value to either its 6-bit reconstruction value
|
|
* or a negative number indicating some other meaning.
|
|
* or a negative number indicating some other meaning.
|
|
**/
|
|
**/
|
|
- private final static byte[] _STANDARD_DECODABET = {
|
|
|
|
|
|
+ private static final byte[] _STANDARD_DECODABET = {
|
|
-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
|
|
-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
|
|
-5,-5, // Whitespace: Tab and Linefeed
|
|
-5,-5, // Whitespace: Tab and Linefeed
|
|
-9,-9, // Decimal 11 - 12
|
|
-9,-9, // Decimal 11 - 12
|
|
@@ -135,7 +135,7 @@ final class Base64Codec {
|
|
* <a href="http://www.faqs.org/rfcs/rfc3548.html">http://www.faqs.org/rfcs/rfc3548.html</a>.
|
|
* <a href="http://www.faqs.org/rfcs/rfc3548.html">http://www.faqs.org/rfcs/rfc3548.html</a>.
|
|
* Notice that the last two bytes become "hyphen" and "underscore" instead of "plus" and "slash."
|
|
* Notice that the last two bytes become "hyphen" and "underscore" instead of "plus" and "slash."
|
|
*/
|
|
*/
|
|
- private final static byte[] _URL_SAFE_ALPHABET = {
|
|
|
|
|
|
+ private static final byte[] _URL_SAFE_ALPHABET = {
|
|
(byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
|
|
(byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
|
|
(byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
|
|
(byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
|
|
(byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
|
|
(byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
|
|
@@ -151,7 +151,7 @@ final class Base64Codec {
|
|
/**
|
|
/**
|
|
* Used in decoding URL- and Filename-safe dialects of Base64.
|
|
* Used in decoding URL- and Filename-safe dialects of Base64.
|
|
*/
|
|
*/
|
|
- private final static byte[] _URL_SAFE_DECODABET = {
|
|
|
|
|
|
+ private static final byte[] _URL_SAFE_DECODABET = {
|
|
-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
|
|
-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
|
|
-5,-5, // Whitespace: Tab and Linefeed
|
|
-5,-5, // Whitespace: Tab and Linefeed
|
|
-9,-9, // Decimal 11 - 12
|
|
-9,-9, // Decimal 11 - 12
|
|
@@ -198,7 +198,7 @@ final class Base64Codec {
|
|
* and it is described here:
|
|
* and it is described here:
|
|
* <a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/qa/rfcc-1940.html</a>.
|
|
* <a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/qa/rfcc-1940.html</a>.
|
|
*/
|
|
*/
|
|
- private final static byte[] _ORDERED_ALPHABET = {
|
|
|
|
|
|
+ private static final byte[] _ORDERED_ALPHABET = {
|
|
(byte)'-',
|
|
(byte)'-',
|
|
(byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4',
|
|
(byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4',
|
|
(byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9',
|
|
(byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9',
|
|
@@ -216,7 +216,7 @@ final class Base64Codec {
|
|
/**
|
|
/**
|
|
* Used in decoding the "ordered" dialect of Base64.
|
|
* Used in decoding the "ordered" dialect of Base64.
|
|
*/
|
|
*/
|
|
- private final static byte[] _ORDERED_DECODABET = {
|
|
|
|
|
|
+ private static final byte[] _ORDERED_DECODABET = {
|
|
-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
|
|
-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8
|
|
-5,-5, // Whitespace: Tab and Linefeed
|
|
-5,-5, // Whitespace: Tab and Linefeed
|
|
-9,-9, // Decimal 11 - 12
|
|
-9,-9, // Decimal 11 - 12
|