Go - decode / encode asn.1

Does anyone know where there is a good example of how to use the asn1 Marshal and Unmarshal functions in Go?

I am familiar with the concept of how DER encoding works with ASN.1, but I have no experience working with it directly in the code (usually I use another library with wrappers - openldap or something else).

Yes, I looked at the documentation ( http://golang.org/pkg/encoding/asn1/ ), which seems to describe the tag system in the same way as what is available for JSON and XML in Go; however, I have yet to find a good practical example of this for the encoding / asn1 package. (Hm, well I see an example certificate in asn1_test.go - does anyone know anything else?)

(In general, I am trying to implement a very small subset of LDAP (server side) in Go.)

UPDATE: My question is mistaken in the fact that LDAP uses BER, not DER. Therefore, encoding /asn.1 will not help. Anyway, I ended up with this: https://github.com/bradleypeabody/godap (which uses this for BER + ASN1: https://github.com/go-asn1-ber/asn1-ber )

+6
source share

Source: https://habr.com/ru/post/1205911/


All Articles