A minimal reader and writer of DER, the binary encoding of X.509 certificates, CRLs, OCSP responses and time-stamp tokens (RFC 3161), for what the OpenSSL extension of PHP does not expose: the fields of names, the extensions and their criticality, the structures of the seals. Every malformation throws, and what is read is then refused. Only DER is read: an indefinite length is a malformation.
An element is an array with two keys: 'tag', its identifier octet (class, constructed bit and tag number), and 'content', its content octets (a binary string).
| Methods | ||
|---|---|---|
public
static
|
readElements(string $buffer): array
|
# |
public
static
|
readElement(string $buffer): array
|
# |
public
static
|
childrenOf(array $element, int $tag): array
|
# |
public
static
|
decodeOid(array $element): string
|
# |
public
static
|
decodeBoolean(array $element): boolean
|
# |
public
static
|
decodeSmallInteger(array $element): int
|
# |
public
static
|
decodeBits(array $element): array
|
# |
public
static
|
decodeBitStringBytes(array $element): string
|
# |
public
static
|
decodeGeneralizedTime(array $element): float
|
# |
public
static
|
decodeTime(array $element): float
|
# |
public
static
|
decodeUnsigned(array $element): string
|
# |
public
static
|
encode(int $tag, string ...$content): string
|
# |
public
static
|
reencode(array $element): string
|
# |
public
static
|
encodeOid(string $oid): string
|
# |
public
static
|
encodeInteger(string|int $value): string
|
# |
| Constants | |||
|---|---|---|---|
public
|
BOOLEAN = 0x01
|
# | |
public
|
INTEGER = 0x02
|
# | |
public
|
BIT_STRING = 0x03
|
# | |
public
|
OCTET_STRING = 0x04
|
# | |
public
|
NULL = 0x05
|
# | |
public
|
OID = 0x06
|
# | |
public
|
ENUMERATED = 0x0a
|
# | |
public
|
UTF8_STRING = 0x0c
|
# | |
public
|
PRINTABLE_STRING = 0x13
|
# | |
public
|
IA5_STRING = 0x16
|
# | |
public
|
UTC_TIME = 0x17
|
# | |
public
|
GENERALIZED_TIME = 0x18
|
# | |
public
|
SEQUENCE = 0x30
|
# | |
public
|
SET = 0x31
|
# | |