cpusoft / asn1go

ASN.1 schema parsing and code generation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

asn1go

Rationale

Currently existing Go libraries for asn1 support are either reflection-based (crypto/asn1) or very low-level (golang.org/x/crypto/cryptobyte). Idea is to provide Protobuf-like experience for working with ASN1 in Golang.

Originally started to back gorberos kerberos wannabe-library.

Architecture

  1. Custom Lexer consumes from bufio.Reader and called by Parser
  2. Parser is built using goyacc based on BNF provided in X.680 standard. As the result, Parser produces ASN1 module AST.
  3. AST is used by Code Generator to produce declarations, serialization, and deserialization code.

Roadmap

  1. Lexer
  • identifiers
  • numbers
  • keywords
  • symbols
  • strings, bit strings, hex strings
  • XML
  1. Parser
  • module definition BNF
  • parse Kerberos (rfc4120)
  • yield AST from parser
  • parse SNMPv1 (rfc1157, rfc1155)
  • parse LDAP (rfc4511)
  • SNMPv2 (rfc3411–3418)
  1. Code Generator
  • declaration generator
  • crypto/asn1 compatible generation mode
  • verify serialization on Kerberos
  • DER serialization generator
  • DER deserialization generator

About

ASN.1 schema parsing and code generation

License:Apache License 2.0


Languages

Language:Go 81.4%Language:Yacc 18.3%Language:Makefile 0.2%