Identifier
in package
The Identifier encodes the ASN.1 tag (class and number) of the type of a data value.
Every identifier whose number is in the range 0 to 30 has the following structure:
Bits: 8 7 6 5 4 3 2 1 | Class | P/C | Tag number | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Bits 8 and 7 define the class of this type ( Universal, Application, Context-specific or Private). Bit 6 encoded whether this type is primitive or constructed The remaining bits 5 - 1 encode the tag number
Table of Contents
- BITSTRING = 0x3
- BMP_STRING = 0x1e
- BOOLEAN = 0x1
- CHARACTER_STRING = 0x1d
- CLASS_APPLICATION = 0x1
- CLASS_CONTEXT_SPECIFIC = 0x2
- CLASS_PRIVATE = 0x3
- CLASS_UNIVERSAL = 0x0
- EMBEDDED_PDV = 0xb
- ENUMERATED = 0xa
- EOC = 0x0
- EXTERNAL = 0x8
- GENERAL_STRING = 0x1b
- GENERALIZED_TIME = 0x18
- GRAPHIC_STRING = 0x19
- IA5_STRING = 0x16
- INTEGER = 0x2
- IS_CONSTRUCTED = 0x20
- LONG_FORM = 0x1f
- NULL = 0x5
- NUMERIC_STRING = 0x12
- OBJECT_DESCRIPTOR = 0x7
- OBJECT_IDENTIFIER = 0x6
- OCTETSTRING = 0x4
- PRINTABLE_STRING = 0x13
- REAL = 0x9
- RELATIVE_OID = 0xd
- SEQUENCE = 0x30
- SET = 0x31
- T61_STRING = 0x14
- UNIVERSAL_STRING = 0x1c
- UTC_TIME = 0x17
- UTF8_STRING = 0xc
- VIDEOTEXT_STRING = 0x15
- VISIBLE_STRING = 0x1a
- create() : int|string
- Creates an identifier. Short form identifiers are returned as integers for BC, long form identifiers will be returned as a string of octets.
- getClassDescription() : string
- Returns a textual description of the information encoded in a given identifier octet.
- getName() : string
- Return the name of the mapped ASN.1 type with a preceding "ASN.1 ".
- getShortName() : string
- Return the short version of the type name.
- getTagNumber() : int
- isApplicationClass() : mixed
- isConstructed() : mixed
- isContextSpecificClass() : mixed
- isLongForm() : mixed
- isPrivateClass() : mixed
- isUniversalClass() : mixed
- makeNumeric() : mixed
Constants
BITSTRING
public
mixed
BITSTRING
= 0x3
BMP_STRING
public
mixed
BMP_STRING
= 0x1e
BOOLEAN
public
mixed
BOOLEAN
= 0x1
CHARACTER_STRING
public
mixed
CHARACTER_STRING
= 0x1d
CLASS_APPLICATION
public
mixed
CLASS_APPLICATION
= 0x1
CLASS_CONTEXT_SPECIFIC
public
mixed
CLASS_CONTEXT_SPECIFIC
= 0x2
CLASS_PRIVATE
public
mixed
CLASS_PRIVATE
= 0x3
CLASS_UNIVERSAL
public
mixed
CLASS_UNIVERSAL
= 0x0
EMBEDDED_PDV
public
mixed
EMBEDDED_PDV
= 0xb
ENUMERATED
public
mixed
ENUMERATED
= 0xa
EOC
public
mixed
EOC
= 0x0
EXTERNAL
public
mixed
EXTERNAL
= 0x8
GENERAL_STRING
public
mixed
GENERAL_STRING
= 0x1b
GENERALIZED_TIME
public
mixed
GENERALIZED_TIME
= 0x18
GRAPHIC_STRING
public
mixed
GRAPHIC_STRING
= 0x19
IA5_STRING
public
mixed
IA5_STRING
= 0x16
INTEGER
public
mixed
INTEGER
= 0x2
IS_CONSTRUCTED
public
mixed
IS_CONSTRUCTED
= 0x20
LONG_FORM
public
mixed
LONG_FORM
= 0x1f
NULL
public
mixed
NULL
= 0x5
NUMERIC_STRING
public
mixed
NUMERIC_STRING
= 0x12
OBJECT_DESCRIPTOR
public
mixed
OBJECT_DESCRIPTOR
= 0x7
OBJECT_IDENTIFIER
public
mixed
OBJECT_IDENTIFIER
= 0x6
OCTETSTRING
public
mixed
OCTETSTRING
= 0x4
PRINTABLE_STRING
public
mixed
PRINTABLE_STRING
= 0x13
REAL
public
mixed
REAL
= 0x9
RELATIVE_OID
public
mixed
RELATIVE_OID
= 0xd
SEQUENCE
public
mixed
SEQUENCE
= 0x30
SET
public
mixed
SET
= 0x31
T61_STRING
public
mixed
T61_STRING
= 0x14
UNIVERSAL_STRING
public
mixed
UNIVERSAL_STRING
= 0x1c
UTC_TIME
public
mixed
UTC_TIME
= 0x17
UTF8_STRING
public
mixed
UTF8_STRING
= 0xc
VIDEOTEXT_STRING
public
mixed
VIDEOTEXT_STRING
= 0x15
VISIBLE_STRING
public
mixed
VISIBLE_STRING
= 0x1a
Methods
create()
Creates an identifier. Short form identifiers are returned as integers for BC, long form identifiers will be returned as a string of octets.
public
static create(int $class, bool $isConstructed, int $tagNumber) : int|string
Parameters
- $class : int
- $isConstructed : bool
- $tagNumber : int
Tags
Return values
int|string —getClassDescription()
Returns a textual description of the information encoded in a given identifier octet.
public
static getClassDescription(int|string $identifier) : string
The first three (most significant) bytes are evaluated to determine if this is a constructed or primitive type and if it is either universal, application, context-specific or private.
Example: Constructed context-specific Primitive universal
Parameters
- $identifier : int|string
Return values
string —getName()
Return the name of the mapped ASN.1 type with a preceding "ASN.1 ".
public
static getName(int|string $identifier) : string
Example: ASN.1 Octet String
Parameters
- $identifier : int|string
Tags
Return values
string —getShortName()
Return the short version of the type name.
public
static getShortName(int|string $identifier) : string
If the given identifier octet can be mapped to a known universal type this will return its name. Else Identifier::getClassDescription() is used to retrieve information about the identifier.
Parameters
- $identifier : int|string
Tags
Return values
string —getTagNumber()
public
static getTagNumber(int|string $identifier) : int
Parameters
- $identifier : int|string
Return values
int —isApplicationClass()
public
static isApplicationClass(mixed $identifier) : mixed
Parameters
- $identifier : mixed
Return values
mixed —isConstructed()
public
static isConstructed(mixed $identifierOctet) : mixed
Parameters
- $identifierOctet : mixed
Return values
mixed —isContextSpecificClass()
public
static isContextSpecificClass(mixed $identifier) : mixed
Parameters
- $identifier : mixed
Return values
mixed —isLongForm()
public
static isLongForm(mixed $identifierOctet) : mixed
Parameters
- $identifierOctet : mixed
Return values
mixed —isPrivateClass()
public
static isPrivateClass(mixed $identifier) : mixed
Parameters
- $identifier : mixed
Return values
mixed —isUniversalClass()
public
static isUniversalClass(mixed $identifier) : mixed
Parameters
- $identifier : mixed
Return values
mixed —makeNumeric()
private
static makeNumeric(mixed $identifierOctet) : mixed
Parameters
- $identifierOctet : mixed