Class TokenUtil


  • public class TokenUtil
    extends Object
    Utility to do base 64 or base 32 encoding of strings. Read the specs for base 32

    This also provides methods to test if a given string is base 32 or base 64 encoded.

    Created by Jeff Gaynor
    on 10/21/21 at 4:06 PM

    • Field Detail

      • trailingChar

        public static char trailingChar
      • padding32

        public static String padding32
      • base32

        protected static org.apache.commons.codec.binary.Base32 base32
    • Constructor Detail

      • TokenUtil

        public TokenUtil()
    • Method Detail

      • b64EncodeToken

        public static String b64EncodeToken​(String token)
      • b32Encode

        public static String b32Encode​(byte[] b)
      • b32EncodeToken

        public static String b32EncodeToken​(String token)
      • b64DecodeToken

        public static String b64DecodeToken​(String b64EncodedToken)
      • b32DecodeToken

        public static String b32DecodeToken​(String b32EncodedToken)
      • isBase64

        public static boolean isBase64​(String x)
      • isBase32

        public static boolean isBase32​(String x)
        NOTE we have tweaked this to use underscore for padding, not the standard equals sign since we want nothing to be escaped.
        Parameters:
        x -
        Returns: