asn1dynamic

package module
v0.0.0-...-be7aaa6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2019 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(on ...bool) bool

func Errorf

func Errorf(frm string, arg ...interface{}) error

func ExplicitMode

func ExplicitMode()

func ImplicitMode

func ImplicitMode()

func NewDataReader

func NewDataReader(r io.Reader, size int) asnReader

func NewFieldList

func NewFieldList(fld map[string]interface{}) (*fieldList, error)

Types

type AsnAny

type AsnAny interface {
	AsnElm
	AsnPath
	AnySetByName(name string, el AsnElm, err error) error
	AnySet(el AsnElm, err error) error

	AnyNull(name string) error
	AnyBoolean(name string, val bool) error
	AnyInteger(name string, val int) error
	AnyReal(name string, val float64) error
	AnyEnumerated(name string, val string) error
	AnyBitString(name string, val BitStr) error
	AnyUTCTime(name string, val time.Time) error
	AnyGeneralizedTime(name string, val time.Time) error
	AnyObjectIdentifier(name string, val OID) error
	AnyObjectDescriptor(name string, val string) error
	AnyNumericString(name string, val string) error
	AnyPrintableString(name string, val string) error
	AnyIA5String(name string, val string) error
	AnyUTF8String(name string, val string) error
	AnyOctetString(name string, val []byte) error

	AnySequence(name string) (out AsnSeq, err error)
	AnyChoice(name string) (out AsnChoice, err error)
}

type AsnChoice

type AsnChoice interface {
	AsnElm
	AsnPath
	ChoiceSetByName(name string, el AsnElm, err error) error
	ChoiceSet(el AsnElm, err error) error

	ChoiceNull(name string) error
	ChoiceBoolean(name string, val bool) error
	ChoiceInteger(name string, val int) error
	ChoiceReal(name string, val float64) error
	ChoiceEnumerated(name string, val string) error
	ChoiceBitString(name string, val BitStr) error
	ChoiceUTCTime(name string, val time.Time) error
	ChoiceGeneralizedTime(name string, val time.Time) error
	ChoiceObjectIdentifier(name string, val OID) error
	ChoiceObjectDescriptor(name string, val string) error
	ChoiceNumericString(name string, val string) error
	ChoicePrintableString(name string, val string) error
	ChoiceIA5String(name string, val string) error
	ChoiceUTF8String(name string, val string) error
	ChoiceOctetString(name string, val []byte) error

	ChoiceSequence(name string) (out AsnSeq, err error)
	ChoiceChoice(name string) (out AsnChoice, err error)
	ChoiceAny(name string) (out AsnAny, err error)
}

type AsnContext

type AsnContext struct {
	// contains filtered or unexported fields
}

type AsnData

type AsnData struct {
	// contains filtered or unexported fields
}

func AsnElm2AsnData

func AsnElm2AsnData(th AsnElm) *AsnData

func AsnElm2AsnDataSub

func AsnElm2AsnDataSub(th AsnElm) []*AsnData

func (*AsnData) AddAny

func (th *AsnData) AddAny() (out AsnAny, err error)

func (*AsnData) AddBitString

func (th *AsnData) AddBitString(val BitStr) error

func (*AsnData) AddBoolean

func (th *AsnData) AddBoolean(val bool) error

func (*AsnData) AddChoice

func (th *AsnData) AddChoice() (out AsnChoice, err error)

func (*AsnData) AddEnumerated

func (th *AsnData) AddEnumerated(val string) error

func (*AsnData) AddGeneralizedTime

func (th *AsnData) AddGeneralizedTime(val time.Time) error

func (*AsnData) AddIA5String

func (th *AsnData) AddIA5String(val string) error

func (*AsnData) AddInteger

func (th *AsnData) AddInteger(val int) error

func (*AsnData) AddNumericString

func (th *AsnData) AddNumericString(val string) error

func (*AsnData) AddObjectDescriptor

func (th *AsnData) AddObjectDescriptor(val string) error

func (*AsnData) AddObjectIdentifier

func (th *AsnData) AddObjectIdentifier(val OID) error

func (*AsnData) AddOctetString

func (th *AsnData) AddOctetString(val []byte) error

func (*AsnData) AddPrintableString

func (th *AsnData) AddPrintableString(val string) error

func (*AsnData) AddReal

func (th *AsnData) AddReal(val float64) error

func (*AsnData) AddSequence

func (th *AsnData) AddSequence() (out AsnSeq, err error)

func (*AsnData) AddUTCTime

func (th *AsnData) AddUTCTime(val time.Time) error

func (*AsnData) AddUTF8String

func (th *AsnData) AddUTF8String(val string) error

func (*AsnData) Any

func (th *AsnData) Any(name string) (out AsnAny, err error)

func (*AsnData) AnyBitString

func (th *AsnData) AnyBitString(name string, val BitStr) error

func (*AsnData) AnyBoolean

func (th *AsnData) AnyBoolean(name string, val bool) error

func (*AsnData) AnyChoice

func (th *AsnData) AnyChoice(name string) (out AsnChoice, err error)

func (*AsnData) AnyEnumerated

func (th *AsnData) AnyEnumerated(name string, val string) error

func (*AsnData) AnyGeneralizedTime

func (th *AsnData) AnyGeneralizedTime(name string, val time.Time) error

func (*AsnData) AnyIA5String

func (th *AsnData) AnyIA5String(name string, val string) error

func (*AsnData) AnyInteger

func (th *AsnData) AnyInteger(name string, val int) error

func (*AsnData) AnyNull

func (th *AsnData) AnyNull(name string) error

func (*AsnData) AnyNumericString

func (th *AsnData) AnyNumericString(name string, val string) error

func (*AsnData) AnyObjectDescriptor

func (th *AsnData) AnyObjectDescriptor(name string, val string) error

func (*AsnData) AnyObjectIdentifier

func (th *AsnData) AnyObjectIdentifier(name string, val OID) error

func (*AsnData) AnyOctetString

func (th *AsnData) AnyOctetString(name string, val []byte) error

func (*AsnData) AnyPrintableString

func (th *AsnData) AnyPrintableString(name string, val string) error

func (*AsnData) AnyReal

func (th *AsnData) AnyReal(name string, val float64) error

func (*AsnData) AnySequence

func (th *AsnData) AnySequence(name string) (out AsnSeq, err error)

func (*AsnData) AnySet

func (th *AsnData) AnySet(el AsnElm, err error) error

func (*AsnData) AnySetByName

func (th *AsnData) AnySetByName(name string, el AsnElm, err error) error

func (*AsnData) AnyUTCTime

func (th *AsnData) AnyUTCTime(name string, val time.Time) error

func (*AsnData) AnyUTF8String

func (th *AsnData) AnyUTF8String(name string, val string) error

func (*AsnData) BitString

func (th *AsnData) BitString(name string, val BitStr) (out AsnElm, err error)

func (*AsnData) Boolean

func (th *AsnData) Boolean(name string, val bool) (out AsnElm, err error)

func (*AsnData) Choice

func (th *AsnData) Choice(name string) (out AsnChoice, err error)

func (*AsnData) ChoiceAny

func (th *AsnData) ChoiceAny(name string) (out AsnAny, err error)

func (*AsnData) ChoiceBitString

func (th *AsnData) ChoiceBitString(name string, val BitStr) error

func (*AsnData) ChoiceBoolean

func (th *AsnData) ChoiceBoolean(name string, val bool) error

func (*AsnData) ChoiceChoice

func (th *AsnData) ChoiceChoice(name string) (out AsnChoice, err error)

func (*AsnData) ChoiceEnumerated

func (th *AsnData) ChoiceEnumerated(name string, val string) error

func (*AsnData) ChoiceGeneralizedTime

func (th *AsnData) ChoiceGeneralizedTime(name string, val time.Time) error

func (*AsnData) ChoiceIA5String

func (th *AsnData) ChoiceIA5String(name string, val string) error

func (*AsnData) ChoiceInteger

func (th *AsnData) ChoiceInteger(name string, val int) error

func (*AsnData) ChoiceNull

func (th *AsnData) ChoiceNull(name string) error

func (*AsnData) ChoiceNumericString

func (th *AsnData) ChoiceNumericString(name string, val string) error

func (*AsnData) ChoiceObjectDescriptor

func (th *AsnData) ChoiceObjectDescriptor(name string, val string) error

func (*AsnData) ChoiceObjectIdentifier

func (th *AsnData) ChoiceObjectIdentifier(name string, val OID) error

func (*AsnData) ChoiceOctetString

func (th *AsnData) ChoiceOctetString(name string, val []byte) error

func (*AsnData) ChoicePrintableString

func (th *AsnData) ChoicePrintableString(name string, val string) error

func (*AsnData) ChoiceReal

func (th *AsnData) ChoiceReal(name string, val float64) error

func (*AsnData) ChoiceSequence

func (th *AsnData) ChoiceSequence(name string) (out AsnSeq, err error)

func (*AsnData) ChoiceSet

func (th *AsnData) ChoiceSet(el AsnElm, err error) error

func (*AsnData) ChoiceSetByName

func (th *AsnData) ChoiceSetByName(name string, el AsnElm, err error) error

func (*AsnData) ChoiceUTCTime

func (th *AsnData) ChoiceUTCTime(name string, val time.Time) error

func (*AsnData) ChoiceUTF8String

func (th *AsnData) ChoiceUTF8String(name string, val string) error

func (*AsnData) Decode

func (th *AsnData) Decode(sheme *Sheme) (*simplejson.Json, error)

func (*AsnData) Encode

func (th *AsnData) Encode() ([]byte, error)

func (*AsnData) Enumerated

func (th *AsnData) Enumerated(name string, val string) (out AsnElm, err error)

func (*AsnData) GeneralizedTime

func (th *AsnData) GeneralizedTime(name string, val time.Time) (out AsnElm, err error)

func (*AsnData) IA5String

func (th *AsnData) IA5String(name string, val string) (out AsnElm, err error)

func (*AsnData) Integer

func (th *AsnData) Integer(name string, val int) (out AsnElm, err error)

func (*AsnData) Null

func (th *AsnData) Null(name string) (out AsnElm, err error)

func (*AsnData) NumericString

func (th *AsnData) NumericString(name string, val string) (out AsnElm, err error)

func (*AsnData) ObjectDescriptor

func (th *AsnData) ObjectDescriptor(name string, val string) (out AsnElm, err error)

func (*AsnData) ObjectIdentifier

func (th *AsnData) ObjectIdentifier(name string, val OID) (out AsnElm, err error)

func (*AsnData) OctetString

func (th *AsnData) OctetString(name string, val []byte) (out AsnElm, err error)

func (*AsnData) Parse

func (th *AsnData) Parse(data []byte) ([]byte, bool, error)

func (*AsnData) PathAny

func (th *AsnData) PathAny(path ...string) (out AsnAny, err error)

func (*AsnData) PathBitString

func (th *AsnData) PathBitString(val BitStr, path ...string) error

func (*AsnData) PathBoolean

func (th *AsnData) PathBoolean(val bool, path ...string) error

func (*AsnData) PathChoice

func (th *AsnData) PathChoice(path ...string) (out AsnChoice, err error)

func (*AsnData) PathEnumerated

func (th *AsnData) PathEnumerated(val string, path ...string) error

func (*AsnData) PathGeneralizedTime

func (th *AsnData) PathGeneralizedTime(val time.Time, path ...string) error

func (*AsnData) PathIA5String

func (th *AsnData) PathIA5String(val string, path ...string) error

func (*AsnData) PathInteger

func (th *AsnData) PathInteger(val int, path ...string) error

func (*AsnData) PathNull

func (th *AsnData) PathNull(path ...string) error

func (*AsnData) PathNumericString

func (th *AsnData) PathNumericString(val string, path ...string) error

func (*AsnData) PathObjectDescriptor

func (th *AsnData) PathObjectDescriptor(val string, path ...string) error

func (*AsnData) PathObjectIdentifier

func (th *AsnData) PathObjectIdentifier(val OID, path ...string) error

func (*AsnData) PathOctetString

func (th *AsnData) PathOctetString(val []byte, path ...string) error

func (*AsnData) PathPrintableString

func (th *AsnData) PathPrintableString(val string, path ...string) error

func (*AsnData) PathReal

func (th *AsnData) PathReal(val float64, path ...string) error

func (*AsnData) PathSequence

func (th *AsnData) PathSequence(path ...string) (out AsnSeq, err error)

func (*AsnData) PathUTCTime

func (th *AsnData) PathUTCTime(val time.Time, path ...string) error

func (*AsnData) PathUTF8String

func (th *AsnData) PathUTF8String(val string, path ...string) error

func (*AsnData) PrintableString

func (th *AsnData) PrintableString(name string, val string) (out AsnElm, err error)

func (*AsnData) RawData

func (th *AsnData) RawData() []byte

func (*AsnData) Real

func (th *AsnData) Real(name string, val float64) (out AsnElm, err error)

func (*AsnData) SeqField

func (th *AsnData) SeqField(el AsnElm, err error) error

func (*AsnData) SeqFieldByName

func (th *AsnData) SeqFieldByName(name string, el AsnElm, err error) error

func (*AsnData) SeqItem

func (th *AsnData) SeqItem(el AsnElm, err error) error

func (*AsnData) Sequence

func (th *AsnData) Sequence(name string) (out AsnSeq, err error)

func (*AsnData) SetAny

func (th *AsnData) SetAny(name string) (out AsnAny, err error)

func (*AsnData) SetBitString

func (th *AsnData) SetBitString(name string, val BitStr) error

func (*AsnData) SetBoolean

func (th *AsnData) SetBoolean(name string, val bool) error

func (*AsnData) SetChoice

func (th *AsnData) SetChoice(name string) (out AsnChoice, err error)

func (*AsnData) SetEnumerated

func (th *AsnData) SetEnumerated(name string, val string) error

func (*AsnData) SetGeneralizedTime

func (th *AsnData) SetGeneralizedTime(name string, val time.Time) error

func (*AsnData) SetIA5String

func (th *AsnData) SetIA5String(name string, val string) error

func (*AsnData) SetInteger

func (th *AsnData) SetInteger(name string, val int) error

func (*AsnData) SetNull

func (th *AsnData) SetNull(name string) error

func (*AsnData) SetNumericString

func (th *AsnData) SetNumericString(name string, val string) error

func (*AsnData) SetObjectDescriptor

func (th *AsnData) SetObjectDescriptor(name string, val string) error

func (*AsnData) SetObjectIdentifier

func (th *AsnData) SetObjectIdentifier(name string, val OID) error

func (*AsnData) SetOctetString

func (th *AsnData) SetOctetString(name string, val []byte) error

func (*AsnData) SetPrintableString

func (th *AsnData) SetPrintableString(name string, val string) error

func (*AsnData) SetReal

func (th *AsnData) SetReal(name string, val float64) error

func (*AsnData) SetSequence

func (th *AsnData) SetSequence(name string) (out AsnSeq, err error)

func (*AsnData) SetUTCTime

func (th *AsnData) SetUTCTime(name string, val time.Time) error

func (*AsnData) SetUTF8String

func (th *AsnData) SetUTF8String(name string, val string) error

func (*AsnData) UTCTime

func (th *AsnData) UTCTime(name string, val time.Time) (out AsnElm, err error)

func (*AsnData) UTF8String

func (th *AsnData) UTF8String(name string, val string) (out AsnElm, err error)

type AsnElm

type AsnElm interface {
	Encode() ([]byte, error)
	RawData() []byte

	Decode(sheme *Sheme) (*simplejson.Json, error)
	Parse(data []byte) ([]byte, bool, error)
}

func NewDecoder

func NewDecoder() AsnElm

type AsnPath

type AsnPath interface {
	PathNull(path ...string) error
	PathBoolean(val bool, path ...string) error
	PathInteger(val int, path ...string) error
	PathReal(val float64, path ...string) error
	PathEnumerated(val string, path ...string) error
	PathBitString(val BitStr, path ...string) error
	PathUTCTime(val time.Time, path ...string) error
	PathGeneralizedTime(val time.Time, path ...string) error
	PathObjectIdentifier(val OID, path ...string) error
	PathObjectDescriptor(val string, path ...string) error
	PathNumericString(val string, path ...string) error
	PathPrintableString(val string, path ...string) error
	PathIA5String(val string, path ...string) error
	PathUTF8String(val string, path ...string) error
	PathOctetString(val []byte, path ...string) error

	PathSequence(path ...string) (out AsnSeq, err error)
	PathChoice(path ...string) (out AsnChoice, err error)
	PathAny(path ...string) (out AsnAny, err error)
}

type AsnSeq

type AsnSeq interface {
	AsnElm
	AsnPath
	SeqFieldByName(name string, el AsnElm, err error) error
	SeqField(el AsnElm, err error) error
	SeqItem(el AsnElm, err error) error

	SetNull(name string) error
	SetBoolean(name string, val bool) error
	SetInteger(name string, val int) error
	SetReal(name string, val float64) error
	SetEnumerated(name string, val string) error
	SetBitString(name string, val BitStr) error
	SetUTCTime(name string, val time.Time) error
	SetGeneralizedTime(name string, val time.Time) error
	SetObjectIdentifier(name string, val OID) error
	SetObjectDescriptor(name string, val string) error
	SetNumericString(name string, val string) error
	SetPrintableString(name string, val string) error
	SetIA5String(name string, val string) error
	SetUTF8String(name string, val string) error
	SetOctetString(name string, val []byte) error

	SetSequence(name string) (out AsnSeq, err error)
	SetChoice(name string) (out AsnChoice, err error)
	SetAny(name string) (out AsnAny, err error)

	AddBoolean(val bool) error
	AddInteger(val int) error
	AddReal(val float64) error
	AddEnumerated(val string) error
	AddBitString(val BitStr) error
	AddUTCTime(val time.Time) error
	AddGeneralizedTime(val time.Time) error
	AddObjectIdentifier(val OID) error
	AddObjectDescriptor(val string) error
	AddNumericString(val string) error
	AddPrintableString(val string) error
	AddIA5String(val string) error
	AddUTF8String(val string) error
	AddOctetString(val []byte) error

	AddSequence() (out AsnSeq, err error)
	AddChoice() (out AsnChoice, err error)
	AddAny() (out AsnAny, err error)
}

type AsnTag

type AsnTag struct {
	// contains filtered or unexported fields
}

type BitStr

type BitStr struct {
	Bytes     []byte // bits packed into bytes.
	BitLength int    // length in bits.
}

BitString is the structure to use when you want an ASN.1 BIT STRING type. A bit string is padded up to the nearest byte in memory and the number of valid bits is recorded. Padding bits will be zero.

func (BitStr) At

func (b BitStr) At(i int) int

At returns the bit at the given index. If the index is out of range it returns false.

func (BitStr) RightAlign

func (b BitStr) RightAlign() []byte

RightAlign returns a slice where the padding bits are at the beginning. The slice may share memory with the BitString.

type OID

type OID []int

func (OID) String

func (oi OID) String() string

type Sheme

type Sheme struct {
	// contains filtered or unexported fields
}

func NewSheme

func NewSheme(data []byte) (*Sheme, error)

func NewShemeReader

func NewShemeReader(rd io.Reader) (*Sheme, error)

func Wrap

func Wrap(itm map[string]interface{}, name ...string) *Sheme

func (*Sheme) Any

func (sheme *Sheme) Any() (AsnAny, error)

func (*Sheme) BitString

func (sheme *Sheme) BitString(val BitStr) (AsnElm, error)

func (*Sheme) Boolean

func (sheme *Sheme) Boolean(val bool) (AsnElm, error)

func (*Sheme) Choice

func (sheme *Sheme) Choice() (AsnChoice, error)

func (*Sheme) Class

func (s *Sheme) Class(class string) *Sheme

func (*Sheme) DefAttr

func (s *Sheme) DefAttr() interface{}

func (*Sheme) EnumItems

func (s *Sheme) EnumItems() map[int]string

func (*Sheme) Enumerated

func (sheme *Sheme) Enumerated(val string) (AsnElm, error)

func (*Sheme) Explicit

func (s *Sheme) Explicit() bool

func (*Sheme) Field

func (s *Sheme) Field(name string) *Sheme

func (*Sheme) FieldAttr

func (s *Sheme) FieldAttr() map[string]interface{}

func (*Sheme) FieldKeys

func (s *Sheme) FieldKeys() []string

func (*Sheme) FieldList

func (s *Sheme) FieldList() *fieldList

func (*Sheme) FormatAttr

func (s *Sheme) FormatAttr() string

func (*Sheme) GeneralizedTime

func (sheme *Sheme) GeneralizedTime(val time.Time) (AsnElm, error)

func (*Sheme) IA5String

func (sheme *Sheme) IA5String(val string) (AsnElm, error)

func (*Sheme) ID

func (s *Sheme) ID() int

func (*Sheme) Implicit

func (s *Sheme) Implicit() bool

func (*Sheme) Index

func (s *Sheme) Index() int

func (*Sheme) Integer

func (sheme *Sheme) Integer(val int) (AsnElm, error)

func (*Sheme) MaxAttr

func (s *Sheme) MaxAttr() int

func (*Sheme) MinAttr

func (s *Sheme) MinAttr() int

func (*Sheme) Name

func (s *Sheme) Name() string

func (*Sheme) Null

func (sheme *Sheme) Null() (AsnElm, error)

func (*Sheme) NumericString

func (sheme *Sheme) NumericString(val string) (AsnElm, error)

func (*Sheme) ObjectDescriptor

func (sheme *Sheme) ObjectDescriptor(val string) (AsnElm, error)

func (*Sheme) ObjectIdentifier

func (sheme *Sheme) ObjectIdentifier(val OID) (AsnElm, error)

func (*Sheme) OctetString

func (sheme *Sheme) OctetString(val []byte) (AsnElm, error)

func (*Sheme) Of

func (s *Sheme) Of() *Sheme

func (*Sheme) OfAttr

func (s *Sheme) OfAttr() map[string]interface{}

func (*Sheme) Optional

func (s *Sheme) Optional() bool

func (*Sheme) PrintableString

func (sheme *Sheme) PrintableString(val string) (AsnElm, error)

func (*Sheme) Sequence

func (sheme *Sheme) Sequence() (AsnSeq, error)

func (*Sheme) String

func (s *Sheme) String() string

func (*Sheme) Tagged

func (s *Sheme) Tagged() bool

func (*Sheme) Type

func (s *Sheme) Type() string

func (*Sheme) TypeEn

func (s *Sheme) TypeEn() int

func (*Sheme) UTCTime

func (sheme *Sheme) UTCTime(val time.Time) (AsnElm, error)

func (*Sheme) UTF8String

func (sheme *Sheme) UTF8String(val string) (AsnElm, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL