Encode a simple struct
type Point struct{ X, Y int }
b, _ := asn1.Marshal(Point{3, 4})
fmt.Printf("% x\n", b)
var p Point
asn1.Unmarshal(b, &p)
fmt.Println(p)
encoding/asn1ASN.1 DER encoding — the format certificates, private keys, and X.509 structures live in. Reach for this when interoperating with PKI.
type Point struct{ X, Y int }
b, _ := asn1.Marshal(Point{3, 4})
fmt.Printf("% x\n", b)
var p Point
asn1.Unmarshal(b, &p)
fmt.Println(p)
type Cert struct {
Version int `asn1:"optional,explicit,default:1,tag:0"`
Subject string
}