Documentation ¶
Overview ¶
package ber provides utilities for working with BER encoded data structures
Index ¶
- func Get(data []byte, tag uint32, optional bool) (body, rest []byte, err error)
- func Marshal(obj interface{}) ([]byte, error)
- func MarshalValue(val reflect.Value) ([]byte, error)
- func Next(data []byte) (tag uint32, body, rest []byte, err error)
- func NextLength(data []byte) (length int, rest []byte, err error)
- func NextTag(data []byte) (tag uint32, rest []byte, err error)
- func PackTag(tag uint32) []byte
- func Put(buf []byte, tag uint32, data []byte) ([]byte, error)
- func Unmarshal(buf []byte, obj interface{}) error
- func UnmarshalValue(buf []byte, val reflect.Value) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Marshal ¶
Marshal marshals an object as BER/DER
The specified object must be a structure. Members will be iterated and automatically BER encoded. The struct will not itself be enclosed in a tag
Any unnamed struct member will be inlined directly. Pointer values are considered optional: nil will not be marshalled, and on unmarshalling absence shall be treated as nil
Struct members must be tagged with the `ber` tag. If this tag is set to `-`, then the field will be skipped. Otherwise, it should be a smartcard style/wire-format hex tag as opposed to the ASN.1 format tags used by the Go marshal/asn.1 package
The tag value may be followed by any of a number of comma separated flag values. These can be:
* One of an encoding control flag. Valid encoding control flags are
- `ber`: Marshal the nested object as if by a recursive call to Marshal
- `big` or `bin_big`: Marshal the nested object using encoding/binary in big endian
- `little` or `bin_little`: Same but little endian
- `asn1`: Marshal the nested object using encoding/asn1
If no encoding control flag is specified, then ¶
* `[]byte` or `string` is encoded directly * All other types are required to implement MarshalBinary
func MarshalValue ¶
MarshalsValue marshals a reflect.Value
func NextLength ¶
NextLength reads a length value from the buffer
Types ¶
This section is empty.