Class Base64URL

java.lang.Object
org.webpki.util.Base64URL

public class Base64URL extends Object
Encodes/decodes base64URL data. See RFC 4648 Table 2.
  • Method Details

    • decode

      public static byte[] decode(String base64Url)
      Decode base64url string.

      This method does not accept padding or line wraps.

      Parameters:
      base64Url - Encoded data in base64url format
      Returns:
      Decoded data as a byte array
      Throws:
      IllegalArgumentException
    • decodePadded

      public static byte[] decodePadded(String base64Url)
      Decode base64url string.

      This method accepts optional padding.

      Note that line wraps are not permitted.

      Parameters:
      base64Url - Encoded data in base64url format
      Returns:
      Decoded data as a byte array
      Throws:
      IllegalArgumentException
    • encode

      public static String encode(byte[] byteArray)
      Encode byte array.

      This method adds no padding or line wraps.

      Parameters:
      byteArray - Binary data
      Returns:
      Encoded data as a base64url string