3 releases (breaking)

0.3.0 May 24, 2021
0.2.0 Mar 11, 2021
0.1.0 Mar 8, 2021

#290 in Encoding

Download history 3/week @ 2021-09-28 3/week @ 2021-10-05 2/week @ 2021-10-12 3/week @ 2021-10-19 23/week @ 2021-10-26 34/week @ 2021-11-02 270/week @ 2021-11-09 736/week @ 2021-11-16 973/week @ 2021-11-23 811/week @ 2021-11-30 768/week @ 2021-12-07 655/week @ 2021-12-14 619/week @ 2021-12-21 585/week @ 2021-12-28 822/week @ 2022-01-04 1059/week @ 2022-01-11

3,191 downloads per month

LGPL-3.0-or-later OR Apache-2.0 OR BSD-2-Clause



bsn1 is a rust library to serialize/deserialize in 'ASN.1' format.

Unlike to other crates, bsn.1 is able to treat class 'Application', 'Context-specific', and 'Private' as well as 'Universal'.

What is ASN.1?

ASN.1 stands for 'Abstract Syntax Notation One' and X.690 is an 'ITU-T' standard specifying the following ASN.1 encoding formats.

  • Basic Encoding Rules (BER)
  • Canonical Encoding Rules (CER)
  • Distinguished Encoding Rules (DER)

This crate supports BER and DER for now.

ASN.1 resembles 'JSON' in some ways because they both are about serializing structured data, however, they differ in the following points.

  • JSON is easy for a human to read, on the other hand, ASN.1 is readable for a computer. i.e. ASN.1 consumes less computer resource like CPU time than JSON does.
  • There are 4 classes in ASN.1 formats, 'Universal', 'Application', 'Context-specific', and 'Private'. Class 'Universal' defines types like 'Integer', 'Boolean', 'String', 'Sequence' and so on like JSON. What is more, ASN.1 allows users to define a new data type using other classes.

ASN.1 has been used all over the world for a long time and it is very stable. For example, 'Transport Layer Security (TLS, SSL)', 'Lightweight Directory Access Protocol (LDAP)', '4th Generation Mobile Communication System (4G)', and so on.

See 'X.690 (07/2002)' for details.

License: LGPL-3.0-or-later OR Apache-2.0 OR BSD-2-Clause

No runtime deps