Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public final class Base64

  1. Object
  2. Base64

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.

Methods

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

Inherited methods

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.