Prokee Module: base64

From prokee
Revision as of 23:59, 8 June 2019 by Andy (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The base64 module provides encoder and decoder for the base64 encoding (as defined in RFC 4648[1]) and variations of it.

Alphabets

The standard alphabet for base64 encoded data is as follows.

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/

As an alternative the base64url encoding uses a URL and filename safe alphabet.

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_

Additionally the module provides functions to specify user defined alphabets. Such alphabets are required to contain exactly 64 different characters. Module bdat can be used for encodings with larger or smaller alphabets.

Padding

The character used for padding is =. The module allows to specify an alternative padding character. Changing the padding character should not be done without a good reason, because it violates the base64 standard.

Padding is added at the end of the encoded data, to fill up incomplete blocks of 24 bits.

Security Considerations

  • false string equality comparisons: Due to non-significant bits at the end of the base64 data.
  • information leaks: Due to non-significant bits at the end of the base64 data.
  • non-alphabet characters: Ignoring of non-alphabet characters may result in possible information leaks and false string equality comparisons.
  • cryptanalysis: The base64 encoding increases the amount of plaintext (without increasing entropy) and produces a characteristic probability distribution which can be exploited for cryptanalysis.

Command-Line Interface

Implementations

References

  1. RFC 4648 - The Base16, Base32, and Base64 Data Encodings, 2008-08-04, IETF Tools, access-date: 2019-05-04