#encoding-rules #codec #ber-der #ber #der #decoding #asn-1

bin+lib bcder

Handling of data encoded in BER, CER, and DER

18 releases

0.7.4 Jan 10, 2024
0.7.3 Sep 13, 2023
0.7.2 Jun 1, 2023
0.7.1 Dec 9, 2022
0.1.0 Oct 23, 2018

#104 in Encoding

Download history 10967/week @ 2024-01-19 16382/week @ 2024-01-26 26938/week @ 2024-02-02 20038/week @ 2024-02-09 18021/week @ 2024-02-16 19848/week @ 2024-02-23 22776/week @ 2024-03-01 18401/week @ 2024-03-08 16244/week @ 2024-03-15 18012/week @ 2024-03-22 17154/week @ 2024-03-29 18787/week @ 2024-04-05 17855/week @ 2024-04-12 22028/week @ 2024-04-19 24579/week @ 2024-04-26 21165/week @ 2024-05-03

89,150 downloads per month
Used in 54 crates (9 directly)

BSD-3-Clause

295KB
5.5K SLoC

bcder – BER, CER, and DER Encoding and Decoding for Rust

This crate provides decoding and encoding for Basic Encoding Rules (BER) of the ASN.1 standard as well as the more strict variants Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER). It provides the basic machinery as well as implementation for the most important universal types of ASN.1.

Usage

Add the following dependency to your Cargo.toml:

[dependencies]
bcder = "^0.1"

A guide introducing ASN.1, BER, and how to use this crate is part of the source as the ber::guide module.

Contributing

If you have comments, proposed changes, or would like to contribute, please open an issue.

License

bcder is distributed under the terms of the BSD-3-clause license. See LICENSE for details.


lib.rs:

Handling of data in Basic Encoding Rules.

This crate allows decoding and encoding of data encoded in ASN.1’s Basic Encoding Rules as defined in ITU recommendation X.690 as well as their stricter companions Cannonical Encoding Rules and Distringuished Encoding Rules.

You will find a short introduction to ASN.1 and encoding rules as well as a discussion of how decoding and encoding with the crate work in the guide module. The documentation with all the other modules serves as a reference documentation.

The most important modules of the crate are decode and encode that provide the machinery for implementing decoding and encoding of data.

Additionally, the crate provides a number of types that help dealing with the more complex universal types in ASN.1. Specifically, the module int provides variable length integers, the module string contains types for the various kinds of strings defined in ASN.1, and oid deals with object identifiers. Finally, captured provides a way to keep encoded data around for later processing. The most important types from these modules are also re-exported at library level.

Dependencies

~245KB