Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Why is there protobuf,Avro,JSON Schema,etc. instead of ASN.1?
3 points by weitzj on July 12, 2022 | hide | past | favorite | 4 comments
I am searching for a nice serialization format which offers a binary and plaintext representation and which allows to specify validation rules.

It seems like reinventing a wheel. And the wheel seems to be ASN.1 as far as I understood.

Could you maybe guide me from your experience why many other serialization formats were invented and why not everybody uses ASN.1 where you already get all kinds of RFCs (e.g 5280) or ISO standards on how to define for example a representation of a TLS certificate and and such.



I tried to use ASN.1 and there were no libraries to use at the time. Protocol buffers exist to product compact messages where varint encoding can shine, and to produce forward-compatible messages when server schemas get updated (I don't know how ASN.1 handles that).


ASN.1 has been around _dramatically_ longer than protobufs - I don't think I can take lack of libraries as a legitimate reason.


Its maturity is not that interesting. I worked with Sun XDR back in the day (roughly the same origin time as ASN.1) and it was massively better in terms of tooling. Even at the time I tried to work with it, I had a hard time finding any decent C or python library that worked smoothly with ASN.1 (define schema, generate bindings, parse and serializes messages). Both of those are dirt-simple in XDR and pb.


There's little to no tooling for most languages.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: