1# [RustCrypto]: ASN.1 DER 2 3[![Crate][crate-image]][crate-link] 4[![Docs][docs-image]][docs-link] 5[![Build Status][build-image]][build-link] 6![Apache2/MIT licensed][license-image] 7![Rust Version][rustc-image] 8[![Project Chat][chat-image]][chat-link] 9 10Pure Rust embedded-friendly implementation of the Distinguished Encoding Rules (DER) 11for Abstract Syntax Notation One (ASN.1) as described in ITU X.690. 12 13[Documentation][docs-link] 14 15## About 16 17This crate provides a `no_std`-friendly implementation of a subset of ASN.1 DER 18necessary for decoding/encoding the following cryptography-related formats 19implemented as crates maintained by the [RustCrypto] project: 20 21- [`pkcs1`]: RSA Cryptography Specifications 22- [`pkcs5`]: Password-Based Cryptography Specification 23- [`pkcs7`]: Cryptographic Message Syntax 24- [`pkcs8`]: Private-Key Information Syntax Specification 25- [`pkcs10`]: Certification Request Syntax Specification 26- [`sec1`]: Elliptic Curve Cryptography 27- [`spki`]: X.509 Subject Public Key Info 28- [`x501`]: Directory Services Types 29- [`x509`]: Public Key Infrastructure Certificate 30 31The core implementation avoids any heap usage (with convenience methods 32that allocate gated under the off-by-default `alloc` feature). 33 34The DER decoder in this crate performs checks to ensure that the input document 35is in canonical form, and will return errors if non-canonical productions are 36encountered. There is currently no way to disable these checks. 37 38### Features 39 40- Rich support for ASN.1 types used by PKCS/PKIX documents 41- Performs DER canonicalization checks at decoding time 42- `no_std` friendly: supports "heapless" usage 43- Optionally supports `alloc` and `std` if desired 44- No hard dependencies! Self-contained implementation with optional 45 integrations with the following crates, all of which are `no_std` friendly: 46 - `const-oid`: const-friendly OID implementation 47 - `pem-rfc7468`: PKCS/PKIX-flavored PEM library with constant-time decoder/encoders 48 - `time` crate: date/time library 49 50## Minimum Supported Rust Version 51 52This crate requires **Rust 1.65** at a minimum. 53 54We may change the MSRV in the future, but it will be accompanied by a minor 55version bump. 56 57## License 58 59Licensed under either of: 60 61 * [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) 62 * [MIT license](http://opensource.org/licenses/MIT) 63 64at your option. 65 66### Contribution 67 68Unless you explicitly state otherwise, any contribution intentionally submitted 69for inclusion in the work by you, as defined in the Apache-2.0 license, shall be 70dual licensed as above, without any additional terms or conditions. 71 72[//]: # (badges) 73 74[crate-image]: https://buildstats.info/crate/der 75[crate-link]: https://crates.io/crates/der 76[docs-image]: https://docs.rs/der/badge.svg 77[docs-link]: https://docs.rs/der/ 78[build-image]: https://github.com/RustCrypto/formats/actions/workflows/der.yml/badge.svg 79[build-link]: https://github.com/RustCrypto/formats/actions/workflows/der.yml 80[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg 81[rustc-image]: https://img.shields.io/badge/rustc-1.65+-blue.svg 82[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg 83[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/300570-formats 84 85[//]: # (links) 86 87[RustCrypto]: https://github.com/rustcrypto 88[`pkcs1`]: https://github.com/RustCrypto/formats/tree/master/pkcs1 89[`pkcs5`]: https://github.com/RustCrypto/formats/tree/master/pkcs5 90[`pkcs7`]: https://github.com/RustCrypto/formats/tree/master/pkcs7 91[`pkcs8`]: https://github.com/RustCrypto/formats/tree/master/pkcs8 92[`pkcs10`]: https://github.com/RustCrypto/formats/tree/master/pkcs10 93[`sec1`]: https://github.com/RustCrypto/formats/tree/master/sec1 94[`spki`]: https://github.com/RustCrypto/formats/tree/master/spki 95[`x501`]: https://github.com/RustCrypto/formats/tree/master/x501 96[`x509`]: https://github.com/RustCrypto/formats/tree/master/x509 97