Skip to content

aellison5505/asn1-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

asn1-pharser

asn1-pharser

asn1-pharser"asn1"ASN1

Class: ASN1

This will decode and build ASN.1 Currently supported tags are

  • BitString
  • ContextSpecific
  • Integer
  • ObjectIdentifier
  • OctetString
  • Sequence
  • PrintableString
  • UTF8String
  • IA5String
  • UTCTime

Hierarchy

  • ASN1

Index

Methods

Methods

bitString

bitString(frameTag: bitStringFrame): BitString

Defined in asn1.ts:40

Parameters:

Name Type
frameTag bitStringFrame

Returns: BitString


build

build(tagBuilder: tagBuilderType): string

Defined in asn1.ts:28

Parameters:

Name Type
tagBuilder tagBuilderType

Returns: string


contextSpecific

contextSpecific(frameTag: contextSpecificFrame): ContextSpecific

Defined in asn1.ts:52

Parameters:

Name Type
frameTag contextSpecificFrame

Returns: ContextSpecific


decode

decode(encoding: Buffer): [string, Map‹string, buildMap›]

Defined in asn1.ts:23

Parameters:

Name Type Description
encoding Buffer Buffer of DER encoded data

Returns: [string, Map‹string, buildMap›]

formatted string of decoded, Map of decoded


integer

integer(frameTag: integerFrame): Integer

Defined in asn1.ts:36

Parameters:

Name Type
frameTag integerFrame

Returns: Integer


objectIdentifier

objectIdentifier(frameTag: objectIdentifierFrame): ObjectIdentifier

Defined in asn1.ts:48

Parameters:

Name Type
frameTag objectIdentifierFrame

Returns: ObjectIdentifier


octetString

octetString(frameTag: octetStringFrame): OctetString

Defined in asn1.ts:44

Parameters:

Name Type
frameTag octetStringFrame

Returns: OctetString


sequence

sequence(frameTag: sequenceFrame): Sequence

Defined in asn1.ts:32

Parameters:

Name Type
frameTag sequenceFrame

Returns: Sequence

asn1-pharser"decode"Decode

Class: Decode

Hierarchy

  • Decode

Index

Constructors

Properties

Methods

Constructors

constructor

+ new Decode(): Decode

Defined in decode.ts:10

Returns: Decode

Properties

Private buildMap

buildMap: Map‹string, buildMap

Defined in decode.ts:9


Private decoded

decoded: string

Defined in decode.ts:7


Private pre

pre: number

Defined in decode.ts:8


Private step

step: number

Defined in decode.ts:10

Methods

Private bitString

bitString(encoding: Buffer, count: number): number

Defined in decode.ts:222

Parameters:

Name Type
encoding Buffer
count number

Returns: number


decode

decode(encoding: Buffer): [string, Map‹string, buildMap›]

Defined in decode.ts:19

Parameters:

Name Type
encoding Buffer

Returns: [string, Map‹string, buildMap›]


Private getLength

getLength(encoding: Buffer, count: number): number[]

Defined in decode.ts:52

Parameters:

Name Type
encoding Buffer
count number

Returns: number[]


Private getTag

getTag(encoding: Buffer, count: number): number

Defined in decode.ts:31

Parameters:

Name Type
encoding Buffer
count number

Returns: number


Private integerTag

integerTag(encoding: Buffer, count: number): number

Defined in decode.ts:244

Parameters:

Name Type
encoding Buffer
count number

Returns: number


Private nonUniversal

nonUniversal(encoding: Buffer, count: number, tag: tagClassType): number

Defined in decode.ts:70

Parameters:

Name Type
encoding Buffer
count number
tag tagClassType

Returns: number


Private objectIdentifer

objectIdentifer(encoding: Buffer, count: number): number

Defined in decode.ts:157

Parameters:

Name Type
encoding Buffer
count number

Returns: number


Private octetStringTag

octetStringTag(encoding: Buffer, count: number): number

Defined in decode.ts:260

Parameters:

Name Type
encoding Buffer
count number

Returns: number


Private sequenceTag

sequenceTag(encoding: Buffer, count: number): number

Defined in decode.ts:124

Parameters:

Name Type
encoding Buffer
count number

Returns: number


Private universal

universal(encoding: Buffer, count: number): number

Defined in decode.ts:99

Parameters:

Name Type
encoding Buffer
count number

Returns: number

asn1-pharser"tagBuilders"BitString

Class: BitString

Hierarchy

Index

Constructors

Properties

Accessors

Constructors

constructor

+ new BitString(_frameTag: bitStringFrame): BitString

Overrides TagBuilder.constructor

Defined in tagBuilders.ts:83

Parameters:

Name Type
_frameTag bitStringFrame

Returns: BitString

Properties

Private _frameTag

_frameTag: bitStringFrame

Defined in tagBuilders.ts:86

Accessors

coded

get coded(): Buffer

Inherited from TagBuilder.coded

Defined in tagBuilders.ts:64

Returns: Buffer


data

get data(): Buffer‹›

Inherited from TagBuilder.data

Defined in tagBuilders.ts:33

Returns: Buffer‹›


dataLength

get dataLength(): number

Inherited from TagBuilder.dataLength

Defined in tagBuilders.ts:50

Returns: number


form

get form(): form

Inherited from TagBuilder.form

Defined in tagBuilders.ts:45

Returns: form


length

get length(): number

Inherited from TagBuilder.length

Defined in tagBuilders.ts:54

Returns: number


tag

get tag(): INTEGER | BIT_STRING | OCTET_STRING | NULL | OBJECT_IDENTIFIER | UTF8String | SEQUENCE | SET | PrintableString | IA5String | UTCTime | GeneralizedTime | CUSTOM

Inherited from TagBuilder.tag

Defined in tagBuilders.ts:28

Returns: INTEGER | BIT_STRING | OCTET_STRING | NULL | OBJECT_IDENTIFIER | UTF8String | SEQUENCE | SET | PrintableString | IA5String | UTCTime | GeneralizedTime | CUSTOM


tagClass

get tagClass(): tagClass

Inherited from TagBuilder.tagClass

Defined in tagBuilders.ts:41

Returns: tagClass

asn1-pharser"tagBuilders"ContextSpecific

Class: ContextSpecific

Hierarchy

Index

Constructors

Properties

Accessors

Constructors

constructor

+ new ContextSpecific(_frameTag: contextSpecificFrame): ContextSpecific

Overrides TagBuilder.constructor

Defined in tagBuilders.ts:168

Parameters:

Name Type
_frameTag contextSpecificFrame

Returns: ContextSpecific

Properties

Private _frameTag

_frameTag: contextSpecificFrame

Defined in tagBuilders.ts:170

Accessors

coded

get coded(): Buffer

Inherited from TagBuilder.coded

Defined in tagBuilders.ts:64

Returns: Buffer


data

get data(): Buffer‹›

Inherited from TagBuilder.data

Defined in tagBuilders.ts:33

Returns: Buffer‹›


dataLength

get dataLength(): number

Inherited from TagBuilder.dataLength

Defined in tagBuilders.ts:50

Returns: number


form

get form(): form

Inherited from TagBuilder.form

Defined in tagBuilders.ts:45

Returns: form


length

get length(): number

Inherited from TagBuilder.length

Defined in tagBuilders.ts:54

Returns: number


tag

get tag(): number

Overrides TagBuilder.tag

Defined in tagBuilders.ts:176

Returns: number


tagClass

get tagClass(): tagClass

Inherited from TagBuilder.tagClass

Defined in tagBuilders.ts:41

Returns: tagClass

asn1-pharser"tagBuilders"Integer

Class: Integer

Hierarchy

Index

Constructors

Properties

Accessors

Constructors

constructor

+ new Integer(_frameTag: integerFrame): Integer

Overrides TagBuilder.constructor

Defined in tagBuilders.ts:75

Parameters:

Name Type
_frameTag integerFrame

Returns: Integer

Properties

Private _frameTag

_frameTag: integerFrame

Defined in tagBuilders.ts:78

Accessors

coded

get coded(): Buffer

Inherited from TagBuilder.coded

Defined in tagBuilders.ts:64

Returns: Buffer


data

get data(): Buffer‹›

Inherited from TagBuilder.data

Defined in tagBuilders.ts:33

Returns: Buffer‹›


dataLength

get dataLength(): number

Inherited from TagBuilder.dataLength

Defined in tagBuilders.ts:50

Returns: number


form

get form(): form

Inherited from TagBuilder.form

Defined in tagBuilders.ts:45

Returns: form


length

get length(): number

Inherited from TagBuilder.length

Defined in tagBuilders.ts:54

Returns: number


tag

get tag(): INTEGER | BIT_STRING | OCTET_STRING | NULL | OBJECT_IDENTIFIER | UTF8String | SEQUENCE | SET | PrintableString | IA5String | UTCTime | GeneralizedTime | CUSTOM

Inherited from TagBuilder.tag

Defined in tagBuilders.ts:28

Returns: INTEGER | BIT_STRING | OCTET_STRING | NULL | OBJECT_IDENTIFIER | UTF8String | SEQUENCE | SET | PrintableString | IA5String | UTCTime | GeneralizedTime | CUSTOM


tagClass

get tagClass(): tagClass

Inherited from TagBuilder.tagClass

Defined in tagBuilders.ts:41

Returns: tagClass

asn1-pharser"tagBuilders"ObjectIdentifier

Class: ObjectIdentifier

Hierarchy

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

+ new ObjectIdentifier(_frameTag: objectIdentifierFrame): ObjectIdentifier

Overrides TagBuilder.constructor

Defined in tagBuilders.ts:98

Parameters:

Name Type
_frameTag objectIdentifierFrame

Returns: ObjectIdentifier

Properties

Private _frameTag

_frameTag: objectIdentifierFrame

Defined in tagBuilders.ts:100

Accessors

coded

get coded(): Buffer

Inherited from TagBuilder.coded

Defined in tagBuilders.ts:64

Returns: Buffer


data

get data(): Buffer‹›

Inherited from TagBuilder.data

Defined in tagBuilders.ts:33

Returns: Buffer‹›


dataLength

get dataLength(): number

Inherited from TagBuilder.dataLength

Defined in tagBuilders.ts:50

Returns: number


form

get form(): form

Inherited from TagBuilder.form

Defined in tagBuilders.ts:45

Returns: form


length

get length(): number

Inherited from TagBuilder.length

Defined in tagBuilders.ts:54

Returns: number


tag

get tag(): INTEGER | BIT_STRING | OCTET_STRING | NULL | OBJECT_IDENTIFIER | UTF8String | SEQUENCE | SET | PrintableString | IA5String | UTCTime | GeneralizedTime | CUSTOM

Inherited from TagBuilder.tag

Defined in tagBuilders.ts:28

Returns: INTEGER | BIT_STRING | OCTET_STRING | NULL | OBJECT_IDENTIFIER | UTF8String | SEQUENCE | SET | PrintableString | IA5String | UTCTime | GeneralizedTime | CUSTOM


tagClass

get tagClass(): tagClass

Inherited from TagBuilder.tagClass

Defined in tagBuilders.ts:41

Returns: tagClass

Methods

Private buildObjectId

buildObjectId(): Buffer

Defined in tagBuilders.ts:105

Returns: Buffer

asn1-pharser"tagBuilders"OctetString

Class: OctetString

Hierarchy

Index

Constructors

Properties

Accessors

Constructors

constructor

+ new OctetString(_frameTag: octetStringFrame): OctetString

Overrides TagBuilder.constructor

Defined in tagBuilders.ts:91

Parameters:

Name Type
_frameTag octetStringFrame

Returns: OctetString

Properties

Private _frameTag

_frameTag: octetStringFrame

Defined in tagBuilders.ts:93

Accessors

coded

get coded(): Buffer

Inherited from TagBuilder.coded

Defined in tagBuilders.ts:64

Returns: Buffer


data

get data(): Buffer‹›

Inherited from TagBuilder.data

Defined in tagBuilders.ts:33

Returns: Buffer‹›


dataLength

get dataLength(): number

Inherited from TagBuilder.dataLength

Defined in tagBuilders.ts:50

Returns: number


form

get form(): form

Inherited from TagBuilder.form

Defined in tagBuilders.ts:45

Returns: form


length

get length(): number

Inherited from TagBuilder.length

Defined in tagBuilders.ts:54

Returns: number


tag

get tag(): INTEGER | BIT_STRING | OCTET_STRING | NULL | OBJECT_IDENTIFIER | UTF8String | SEQUENCE | SET | PrintableString | IA5String | UTCTime | GeneralizedTime | CUSTOM

Inherited from TagBuilder.tag

Defined in tagBuilders.ts:28

Returns: INTEGER | BIT_STRING | OCTET_STRING | NULL | OBJECT_IDENTIFIER | UTF8String | SEQUENCE | SET | PrintableString | IA5String | UTCTime | GeneralizedTime | CUSTOM


tagClass

get tagClass(): tagClass

Inherited from TagBuilder.tagClass

Defined in tagBuilders.ts:41

Returns: tagClass

asn1-pharser"tagBuilders"Sequence

Class: Sequence

Hierarchy

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

+ new Sequence(_frameTag: sequenceFrame): Sequence

Overrides TagBuilder.constructor

Defined in tagBuilders.ts:150

Parameters:

Name Type
_frameTag sequenceFrame

Returns: Sequence

Properties

Private _frameTag

_frameTag: sequenceFrame

Defined in tagBuilders.ts:152

Accessors

coded

get coded(): Buffer

Inherited from TagBuilder.coded

Defined in tagBuilders.ts:64

Returns: Buffer


data

get data(): Buffer‹›

Inherited from TagBuilder.data

Defined in tagBuilders.ts:33

Returns: Buffer‹›


dataLength

get dataLength(): number

Inherited from TagBuilder.dataLength

Defined in tagBuilders.ts:50

Returns: number


form

get form(): form

Inherited from TagBuilder.form

Defined in tagBuilders.ts:45

Returns: form


length

get length(): number

Inherited from TagBuilder.length

Defined in tagBuilders.ts:54

Returns: number


tag

get tag(): INTEGER | BIT_STRING | OCTET_STRING | NULL | OBJECT_IDENTIFIER | UTF8String | SEQUENCE | SET | PrintableString | IA5String | UTCTime | GeneralizedTime | CUSTOM

Inherited from TagBuilder.tag

Defined in tagBuilders.ts:28

Returns: INTEGER | BIT_STRING | OCTET_STRING | NULL | OBJECT_IDENTIFIER | UTF8String | SEQUENCE | SET | PrintableString | IA5String | UTCTime | GeneralizedTime | CUSTOM


tagClass

get tagClass(): tagClass

Inherited from TagBuilder.tagClass

Defined in tagBuilders.ts:41

Returns: tagClass

Methods

Private buildData

buildData(): Buffer

Defined in tagBuilders.ts:158

Returns: Buffer

asn1-pharser"tagBuilders"TagBuilder

Class: TagBuilder

Hierarchy

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

+ new TagBuilder(_frame: tagFrameType, _tag: tagType, _tagClass: tagClassType): TagBuilder

Defined in tagBuilders.ts:11

Parameters:

Name Type
_frame tagFrameType
_tag tagType
_tagClass tagClassType

Returns: TagBuilder

Properties

Private _frame

_frame: tagFrameType

Defined in tagBuilders.ts:13


Private _tag

_tag: tagType

Defined in tagBuilders.ts:13


Private _tagClass

_tagClass: tagClassType

Defined in tagBuilders.ts:13

Accessors

coded

get coded(): Buffer

Defined in tagBuilders.ts:64

Returns: Buffer


data

get data(): Buffer‹›

Defined in tagBuilders.ts:33

Returns: Buffer‹›


dataLength

get dataLength(): number

Defined in tagBuilders.ts:50

Returns: number


form

get form(): form

Defined in tagBuilders.ts:45

Returns: form


length

get length(): number

Defined in tagBuilders.ts:54

Returns: number


tag

get tag(): INTEGER | BIT_STRING | OCTET_STRING | NULL | OBJECT_IDENTIFIER | UTF8String | SEQUENCE | SET | PrintableString | IA5String | UTCTime | GeneralizedTime | CUSTOM

Defined in tagBuilders.ts:28

Returns: INTEGER | BIT_STRING | OCTET_STRING | NULL | OBJECT_IDENTIFIER | UTF8String | SEQUENCE | SET | PrintableString | IA5String | UTCTime | GeneralizedTime | CUSTOM


tagClass

get tagClass(): tagClass

Defined in tagBuilders.ts:41

Returns: tagClass

Methods

Private integerBuffer

integerBuffer(int: number): Buffer

Defined in tagBuilders.ts:18

Parameters:

Name Type
int number

Returns: Buffer


Private integerHex

integerHex(int: number): string

Defined in tagBuilders.ts:22

Parameters:

Name Type
int number

Returns: string

asn1-pharser"util"form

Enumeration: form

Index

Enumeration members

Enumeration members

Constructed

Constructed: = 0x1 << 5

Defined in util.ts:15


Primitive

Primitive: = 0

Defined in util.ts:14

asn1-pharser"util"mask

Enumeration: mask

Index

Enumeration members

Enumeration members

bit8

bit8: = 0x01 << 7

Defined in util.ts:42


form

form: = 0x01 << 5

Defined in util.ts:41


tag

tag: = 31

Defined in util.ts:39


tagClass

tagClass: = 0x03 << 6

Defined in util.ts:40

asn1-pharser"util"pre

Enumeration: pre

Index

Enumeration members

Enumeration members

• ****:

Defined in util.ts:46


• ** **:

Defined in util.ts:47


• ** **:

Defined in util.ts:48


• ** **:

Defined in util.ts:49

asn1-pharser"util"tag

Enumeration: tag

Index

Enumeration members

Enumeration members

BIT_STRING

BIT_STRING: = 3

Defined in util.ts:22


CUSTOM

CUSTOM: = 0

Defined in util.ts:33


GeneralizedTime

GeneralizedTime: = 24

Defined in util.ts:32


IA5String

IA5String: = 22

Defined in util.ts:30


INTEGER

INTEGER: = 2

Defined in util.ts:21


NULL

NULL: = 5

Defined in util.ts:24


OBJECT_IDENTIFIER

OBJECT_IDENTIFIER: = 6

Defined in util.ts:25


OCTET_STRING

OCTET_STRING: = 4

Defined in util.ts:23


PrintableString

PrintableString: = 19

Defined in util.ts:29


SEQUENCE

SEQUENCE: = 16

Defined in util.ts:27


SET

SET: = 17

Defined in util.ts:28


UTCTime

UTCTime: = 23

Defined in util.ts:31


UTF8String

UTF8String: = 12

Defined in util.ts:26

asn1-pharser"util"tagClass

Enumeration: tagClass

Index

Enumeration members

Enumeration members

Application

Application: = 0x1 << 6

Defined in util.ts:6


Context_Specific

Context_Specific: = 0x01 << 7

Defined in util.ts:7


Private

Private: = 0x03 << 6

Defined in util.ts:8


Universal

Universal: = 0

Defined in util.ts:5

asn1-pharser

asn1-pharser

Index

Modules

asn1-pharser"util"bitStringFrame

Interface: bitStringFrame

Hierarchy

Index

Properties

Properties

data

data: Buffer

Overrides tagFrame.data

Defined in util.ts:70


Optional form

form? : formType

Inherited from tagFrame.form

Defined in util.ts:61


Optional length

length? : undefined | number

Inherited from tagFrame.length

Defined in util.ts:62

asn1-pharser"util"buildMap

Interface: buildMap

Hierarchy

Index

Properties

Properties

Optional child

child? : Map‹string, buildMap

Defined in util.ts:91


Optional children

children? : Map‹string, buildMap

Defined in util.ts:92


Optional data

data? : Buffer

Inherited from tagFrame.data

Overrides tagFrame.data

Defined in util.ts:63


Optional form

form? : formType

Inherited from tagFrame.form

Overrides tagFrame.form

Defined in util.ts:61


Optional hex

hex? : undefined | string

Defined in util.ts:94


Optional length

length? : undefined | number

Inherited from tagFrame.length

Overrides tagFrame.length

Defined in util.ts:62


Optional str

str? : undefined | string

Inherited from objectIdentifierFrame.str

Defined in util.ts:77


Optional value

value? : any

Defined in util.ts:93

asn1-pharser"util"contextSpecificFrame

Interface: contextSpecificFrame

Hierarchy

Index

Properties

Properties

child

child: tagBuilderType

Defined in util.ts:85


Optional data

data? : Buffer

Inherited from tagFrame.data

Defined in util.ts:63


form

form: formType

Overrides tagFrame.form

Defined in util.ts:86


Optional length

length? : undefined | number

Inherited from tagFrame.length

Defined in util.ts:62


tag

tag: number

Defined in util.ts:87

asn1-pharser"util"integerFrame

Interface: integerFrame

Hierarchy

Index

Properties

Properties

data

data: Buffer

Overrides tagFrame.data

Defined in util.ts:66


Optional form

form? : formType

Inherited from tagFrame.form

Defined in util.ts:61


Optional length

length? : undefined | number

Inherited from tagFrame.length

Defined in util.ts:62

asn1-pharser"util"objectIdentifierFrame

Interface: objectIdentifierFrame

Hierarchy

Index

Properties

Properties

Optional data

data? : Buffer

Inherited from tagFrame.data

Defined in util.ts:63


Optional form

form? : formType

Inherited from tagFrame.form

Defined in util.ts:61


Optional length

length? : undefined | number

Inherited from tagFrame.length

Defined in util.ts:62


Optional str

str? : undefined | string

Defined in util.ts:77

asn1-pharser"util"octetStringFrame

Interface: octetStringFrame

Hierarchy

Index

Properties

Properties

data

data: Buffer

Overrides tagFrame.data

Defined in util.ts:73


Optional form

form? : formType

Inherited from tagFrame.form

Defined in util.ts:61


Optional length

length? : undefined | number

Inherited from tagFrame.length

Defined in util.ts:62

asn1-pharser"util"sequenceFrame

Interface: sequenceFrame

Hierarchy

Index

Properties

Properties

children

children: tagBuilderType[]

Defined in util.ts:81


Optional data

data? : Buffer

Inherited from tagFrame.data

Defined in util.ts:63


form

form: formType

Overrides tagFrame.form

Defined in util.ts:82


Optional length

length? : undefined | number

Inherited from tagFrame.length

Defined in util.ts:62

asn1-pharser"util"tagFrame

Interface: tagFrame

Hierarchy

Index

Properties

Properties

Optional data

data? : Buffer

Defined in util.ts:63


Optional form

form? : formType

Defined in util.ts:61


Optional length

length? : undefined | number

Defined in util.ts:62

asn1-pharser"asn1"

Module: "asn1"

Index

Classes

asn1-pharser"decode"

Module: "decode"

Index

Classes

asn1-pharser"tagBuilders"

Module: "tagBuilders"

Index

Classes

Type aliases

Type aliases

tagBuilderType

Ƭ tagBuilderType: TagBuilder | BitString | ContextSpecific | Integer | ObjectIdentifier | OctetString | Sequence

Defined in tagBuilders.ts:3

asn1-pharser"util"

Module: "util"

Index

Enumerations

Interfaces

Type aliases

Type aliases

formType

Ƭ formType: keyof typeof form

Defined in util.ts:11


maskType

Ƭ maskType: keyof typeof mask

Defined in util.ts:36


tagClassType

Ƭ tagClassType: keyof typeof tagClass

Defined in util.ts:2


tagFrameType

Ƭ tagFrameType: tagFrame | integerFrame | sequenceFrame | bitStringFrame | octetStringFrame | contextSpecificFrame | objectIdentifierFrame

Defined in util.ts:52


tagType

Ƭ tagType: keyof typeof tag

Defined in util.ts:18

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published