setasign\SetaPDF2\Signer\Asn1

Element Class representing an ASN.1 element.

File: /SetaPDF v2/Signer/Asn1/Element.php
Old class name (alias): \SetaPDF_Signer_Asn1_Element

Class hierarchy

Implements

Summary

Constants

BIT_STRING

public const Element::BIT_STRING = ''

Subtype constant

BMPSTRING

public const Element::BMPSTRING = ''

Subtype constant

BOOLEAN

public const Element::BOOLEAN = ''

Subtype constant

ENUMERATED

public const Element::ENUMERATED = ' '

Subtype constant

EXTERNAL

public const Element::EXTERNAL = ''

Subtype constant

GENERALIZED_TIME

public const Element::GENERALIZED_TIME = ''

Subtype constant

GENERAL_STRING

public const Element::GENERAL_STRING = ''

Subtype constant

GRAPHIC_STRING

public const Element::GRAPHIC_STRING = ''

Subtype constant

IA5_STRING

public const Element::IA5_STRING = ''

Subtype constant

INTEGER

public const Element::INTEGER = ''

Subtype constant

IS_CONSTRUCTED

public const Element::IS_CONSTRUCTED = ' '

Constructed?

NULL

public const Element::NULL = ''

Subtype constant

NUMERIC_STRING

public const Element::NUMERIC_STRING = ''

Subtype constant

OBJECT_DESCRIPTOR

public const Element::OBJECT_DESCRIPTOR = ''

Subtype constant

OBJECT_IDENTIFIER

public const Element::OBJECT_IDENTIFIER = ''

Subtype constant

OCTET_STRING

public const Element::OCTET_STRING = ''

Subtype constant

PRINTABLE_STRING

public const Element::PRINTABLE_STRING = ''

Subtype constant

REAL

public const Element::REAL = ' '

Subtype constant

RELATIVE_OID

public const Element::RELATIVE_OID = ' '

Subtype constant

SEQUENCE

public const Element::SEQUENCE = ''

Subtype constant

SET

public const Element::SET = ''

Subtype constant

T61_STRING

public const Element::T61_STRING = ''

Subtype constant

TAG_CLASS_APPLICATION

public const Element::TAG_CLASS_APPLICATION = '@'

Tag class constant

TAG_CLASS_CONTEXT_SPECIFIC

Tag class constant

TAG_CLASS_MASK

public const Element::TAG_CLASS_MASK =

Tag class constant

TAG_CLASS_PRIVATE

public const Element::TAG_CLASS_PRIVATE =

Tag class constant

TAG_CLASS_UNIVERSAL

public const Element::TAG_CLASS_UNIVERSAL = '' . "\0" . ''

Tag class constant

TAG_MASK

public const Element::TAG_MASK = ''

Tag mask

UNIVERSAL_STRING

public const Element::UNIVERSAL_STRING = ''

Subtype constant

UTC_TIME

public const Element::UTC_TIME = ''

Subtype constant

UTF8_STRING

public const Element::UTF8_STRING = ' '

Subtype constant

VIDEOTEXT_STRING

public const Element::VIDEOTEXT_STRING = ''

Subtype constant

VISIBLE_STRING

public const Element::VISIBLE_STRING = ''

Subtype constant


Properties

$_children

protected array Element::$_children = array()

Array of child nodes

Array of Element

$_ident

protected string Element::$_ident = '' . "\0" . ''

The ident tag

$_parent

The parent node

$_value

protected string Element::$_value = ''

The byte value


Static Methods

_parse()

protected static Element::_parse (
string $s,
int &$p = 0,
bool $outer = false
): array

Parses a BER encoded string or sequence.

Parameters
$s : string
 
$p : int
 
$outer : bool
 
Exceptions

Throws Exception

findByOid()

Finds a node by OID.

Parameters
$oid : string

OID in dot form

$value : \SetaPDF_Signer_Asn1_Element

Root node to start from

findByPath()

public static Element::findByPath (
string $path,
\SetaPDF_Signer_Asn1_Element $value
): \SetaPDF_Signer_Asn1_Element|bool

Finds a node by a path.

Parameters
$path : string

A string defining the path of the node (e.g. 1/2/3/5)

$value : \SetaPDF_Signer_Asn1_Element
 

lengthToDer()

public static Element::lengthToDer (
int $length
): string

Returns the length byte in DER encoding.

Parameters
$length : int
 

parse()

public static Element::parse (
string $s
): \SetaPDF_Signer_Asn1_Element

Parses a BER encoded string.

Parameters
$s : string
 
Exceptions

Throws Exception


Methods

__construct()

public Element::__construct (
string $ident,
string $value = '',
array $children = array ( )
)

The constructor.

Parameters
$ident : string

The identifier byte

$value : string

The value in binary form

$children : array

Array of Element instances

__toString()

public Element::__toString (
void
): string

Returns the BER encoded string.

addChild()

Add a child node.

Parameters
$child : \SetaPDF_Signer_Asn1_Element
 

getChild()

Get a child by Id.

Parameters
$id : int
 

getChildCount()

public Element::getChildCount (
void
): int

Get the child count.

getChildren()

Get child nodes.

Return Values

Array of Element

getIdent()

public Element::getIdent (
void
): string

Get the identifier byte.

getParent()

Get parent.

getValue()

public Element::getValue (
void
): string

Get the value.

removeChild()

Remove a child node.

Parameters
$child : \SetaPDF_Signer_Asn1_Element
 

setChildren()

public Element::setChildren (
\SetaPDF_Signer_Asn1_Element[] $children = array ( )
): void

Set child nodes.

Parameters
$children : \SetaPDF_Signer_Asn1_Element[]

Array of Element instances

setIdent()

public Element::setIdent (
string $ident
): void

Set the identifier byte.

Parameters
$ident : string
 

setParent()

Set parent node.

Parameters
$parent : \SetaPDF_Signer_Asn1_Element
 

setValue()

public Element::setValue (
string $value
): void

Set the value.

Parameters
$value : string

Value in binary form