Simple Go ASN1 Canonical Encoding Rules (CER) encoding
int <-> INTEGER
float64 <-> REAL
bool <-> BOOLEAN
struct <-> SEQUENCE
slice <-> SEQUENCEOF
string <-> UTF8String
Usage
import (
"github.com/zaryatech/gocer/pkg/asn1"
)
type TestStuct struct {
Id int
E float64
}
// encode to bytes.Buffer
value := []TestStruct{TestStruct{}, TestStruct{1, math.Pi}}
var bbuffer bytes.Buffer
asn1.Encode(value, &bbuffer)
// decode from bytes.Buffer
var evalue []TestStruct
asn1.Decode(&evalue, &bbuffer)