Documentation ¶
Index ¶
- Constants
- func EncodeTree(tree *Tree) ([]byte, error)
- type ASN1RawValue
- type BigInt
- type Check
- type Choice
- type DER
- type Decoder
- type Explicit
- type Int64
- type Kind
- type Marshaler
- type ObjectIdentifier
- type OctetString
- type Optional
- type RawTree
- type Sequence
- type StructuralError
- type SyntaxError
- type Token
- func (v *Token) AsBigInt() (*big.Int, error)
- func (v *Token) AsBitString() (ret asn1.BitString, err error)
- func (v *Token) AsBool() (ret bool, err error)
- func (v *Token) AsGeneralizedTime() (ret time.Time, err error)
- func (v *Token) AsIA5String() (ret string, err error)
- func (v *Token) AsInt32() (ret int32, err error)
- func (v *Token) AsInt64() (ret int64, err error)
- func (v *Token) AsNumericString() (ret string, err error)
- func (val *Token) AsObjectIdentifier() (s asn1.ObjectIdentifier, err error)
- func (v *Token) AsOctetString() (ret []byte, err error)
- func (v *Token) AsPrintableString() (ret string, err error)
- func (v *Token) AsT61String() (ret string, err error)
- func (v *Token) AsUTCTime() (ret time.Time, err error)
- func (v *Token) AsUTF8String() (ret string, err error)
- func (v *Token) AsVisibleString() (ret string, err error)
- func (v *Token) Universal() (ret interface{}, err error)
- type Tree
Constants ¶
const ( Universal = 0x00 Application = 0x01 Context = 0x02 Private = 0x03 )
const ( TagEOC = 0x00 TagBool = 0x01 TagInteger = 0x02 TagBitString = 0x03 TagOctetString = 0x04 TagNULL = 0x05 TagObjectIdentifier = 0x06 TagObjectDescriptor = 0x07 TagExternal = 0x08 TagRealFloat = 0x09 TagEnumerated = 0x0a TagEmbeddedPDV = 0x0b TagUTF8String = 0x0c TagRelativeOID = 0x0d TagSequence = 0x10 TagSet = 0x11 TagNumericString = 0x12 TagPrintableString = 0x13 TagT61String = 0x14 TagVideotexString = 0x15 TagIA5String = 0x16 TagUTCTime = 0x17 TagGeneralizedTime = 0x18 TagGraphicString = 0x19 TagVisibleString = 0x1a TagGeneralString = 0x1b TagUniversalString = 0x1c TagCharacterString = 0x1d TagBMPString = 0x1e )
Variables ¶
This section is empty.
Functions ¶
func EncodeTree ¶
Types ¶
type ASN1RawValue ¶
func (ASN1RawValue) Marshal ¶
func (m ASN1RawValue) Marshal() (*Tree, error)
func (ASN1RawValue) Unmarshal ¶
func (m ASN1RawValue) Unmarshal(tree *Tree) (err error)
type ObjectIdentifier ¶
type ObjectIdentifier struct {
V *asn1.ObjectIdentifier
}
func (ObjectIdentifier) Marshal ¶
func (m ObjectIdentifier) Marshal() (*Tree, error)
func (ObjectIdentifier) Unmarshal ¶
func (m ObjectIdentifier) Unmarshal(tree *Tree) error
type OctetString ¶
type OctetString struct {
V *[]byte
}
func (OctetString) Marshal ¶
func (m OctetString) Marshal() (*Tree, error)
func (OctetString) Unmarshal ¶
func (m OctetString) Unmarshal(tree *Tree) error
type StructuralError ¶
type StructuralError struct {
Msg string
}
A StructuralError suggests that the ASN.1 data is valid, but the Go type which is receiving it doesn't match.
func (StructuralError) Error ¶
func (e StructuralError) Error() string
type SyntaxError ¶
type SyntaxError struct {
Msg string
}
A SyntaxError suggests that the ASN.1 data is invalid.
func (SyntaxError) Error ¶
func (e SyntaxError) Error() string
type Token ¶
func (*Token) AsBigInt ¶
parseBigInt treats the given bytes as a big-endian, signed integer and returns the result.
func (*Token) AsBitString ¶
AsBitString parses an ASN.1 bit string from the given byte slice and returns it.
func (*Token) AsGeneralizedTime ¶
AsGeneralizedTime parses the GeneralizedTime from the given byte slice and returns the resulting time.
func (*Token) AsIA5String ¶
parseIA5String parses a ASN.1 IA5String (ASCII string) from the given byte slice and returns it.
func (*Token) AsInt32 ¶
AsInt32 treats the given bytes as a big-endian, signed integer and returns the result.
func (*Token) AsInt64 ¶
AsInt64 treats the given bytes as a big-endian, signed integer and returns the result.
func (*Token) AsNumericString ¶
NumericString
func (*Token) AsObjectIdentifier ¶
func (val *Token) AsObjectIdentifier() (s asn1.ObjectIdentifier, err error)
AsObjectIdentifier parses an OBJECT IDENTIFIER from the given bytes and returns it. An object identifier is a sequence of variable length integers that are assigned in a hierarchy.
func (*Token) AsOctetString ¶
func (*Token) AsPrintableString ¶
AsPrintableString parses a ASN.1 PrintableString from the given byte array and returns it.
func (*Token) AsT61String ¶
parseT61String parses a ASN.1 T61String (8-bit clean string) from the given byte slice and returns it.
func (*Token) AsUTF8String ¶
parseUTF8String parses a ASN.1 UTF8String (raw UTF-8) from the given byte array and returns it.
func (*Token) AsVisibleString ¶
AsVisibleString parses a ASN.1 VisibleString from the given byte array and returns it.