Class Base64

java.lang.Object
com.codename1.backend.Base64

public final class Base64 extends Object

Standard base64 (RFC 4648 section 4), with padding.

Not Base64Url: that one is the URL-safe alphabet with the padding stripped, because that is what JWT specifies. These two alphabets are not interchangeable, and the protocols that need this one -- SCRAM-SHA-256 in the PostgreSQL handshake, and AWS request signing -- reject the other.

Decoding is strict about length and alphabet. A lenient decoder is how a signature comparison ends up accepting more than one encoding of the same bytes; see the note in Base64Url.

  • Method Details

    • encode

      public static String encode(byte[] data)
    • decode

      public static byte[] decode(String value)
      The decoded bytes, or null when the input is not valid base64.