Download the PHP package hylianshield/validator-base-encoding without Composer
On this page you can find all versions of the php package hylianshield/validator-base-encoding. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hylianshield/validator-base-encoding
More information about hylianshield/validator-base-encoding
Files in hylianshield/validator-base-encoding
Package validator-base-encoding
Short Description Base64, -32, -16 validation layer
License Apache-2.0
Informations about the package validator-base-encoding
Introduction
The base encoding validators allow the user to validate base64, -32 and -16 encoded messages. The validator will test if the string is encoded in the requested encoding.
Validators will validate against the specification of RFC 4648.
Additionally, the Base32 Crockford implementation is supported.
Installation
Usage
The encoding validators can be configured to require padding or make it optional. Additionally, some implementations require that partitioning will be supported.
The RFC section on the interpretation of non-alphabet characters states:
Implementations MUST reject the encoded data if it contains characters outside the base alphabet when interpreting base-encoded data, unless the specification referring to this document explicitly states otherwise. Such specifications may instead state, as MIME does, that characters outside the base encoding alphabet should simply be ignored when interpreting data ("be liberal in what you accept"). Note that this means that any adjacent carriage return/ line feed (CRLF) characters constitute "non-alphabet characters" and are ignored.
Therefore, the constructors of the validators have the following signature:
With the exception of the Base16Validator
, which does not use padding and
therefore omits the first parameter, as well as the Base32CrockfordValidator
,
which requires padding and as such omits it as well.
Padding validation
CRLF validation
Supported encodings
Validators are defined in the \HylianShield\Validator\BaseEncoding
namespace.
Base 64 encoding
Attribute | Value |
---|---|
Name | base64 |
Specification | RFC 4648 - Section 4 |
Padding | = (optional) |
Partitioning | \r\n (optional) |
Signature
Base 64 Encoding with URL and Filename Safe Alphabet
Attribute | Value |
---|---|
Name | base64url |
Specification | RFC 4648 - Section 5 |
Padding | = (optional) |
Partitioning | \r\n (optional) |
Signature
Base 32 encoding
Attribute | Value |
---|---|
Name | base32 |
Specification | RFC 4648 - Section 6 |
Padding | = (optional) |
Partitioning | \r\n (optional) |
Signature
Base 32 Encoding with Extended Hex Alphabet
Attribute | Value |
---|---|
Name | base32hex |
Specification | RFC 4648 - Section 7 |
Padding | = (optional) |
Partitioning | \r\n (optional) |
Signature
Crockford's Base 32
Attribute | Value |
---|---|
Name | base32crockford |
Specification | Crockford's Base 32 specification |
Padding | 0 (required) |
Partitioning | - (optional) |
Signature
Base 16 encoding
Attribute | Value |
---|---|
Name | base16 |
Specification | RFC 4648 - Section 8 |
Padding | No padding |
Partitioning | \r\n (optional) |