• Home
Name Date Size #Lines LOC

..--

assets/03-May-2024-159134

out/03-May-2024-416290

src/03-May-2024-383181

.cargo_vcs_info.jsonD03-May-202474 65

.gitignoreD03-May-202419 32

Android.bpD03-May-20242.7 KiB10599

Cargo.tomlD03-May-20241.3 KiB4340

Cargo.toml.origD03-May-2024825 4338

LICENSED03-May-202410.6 KiB202169

LICENSE-APACHED03-May-202410.6 KiB202169

LICENSE-MITD03-May-20241 KiB2622

METADATAD03-May-2024388 2019

MODULE_LICENSE_APACHE2D03-May-20240

OWNERSD03-May-2024101 54

README.mdD03-May-20243.1 KiB8758

TEST_MAPPINGD03-May-2024553 3231

build.rsD03-May-2024369 1610

cargo2android.jsonD03-May-2024101 77

README.md

1<!-- cargo-sync-readme start -->
2
3[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE-MIT)
4[![Apache License 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](./LICENSE-APACHE)
5[![docs.rs](https://docs.rs/oid-registry/badge.svg)](https://docs.rs/oid-registry)
6[![crates.io](https://img.shields.io/crates/v/oid-registry.svg)](https://crates.io/crates/oid-registry)
7[![Github CI](https://github.com/rusticata/oid-registry/workflows/Continuous%20integration/badge.svg)](https://github.com/rusticata/oid-registry/actions)
8[![Minimum rustc version](https://img.shields.io/badge/rustc-1.45.0+-lightgray.svg)](#rust-version-requirements)
9# OID Registry
10
11This crate is a helper crate, containing a database of OID objects. These objects are intended
12for use when manipulating ASN.1 grammars and BER/DER encodings, for example.
13
14This crate provides only a simple registry (similar to a `HashMap`) by default. This object can
15be used to get names and descriptions from OID.
16
17This crate provides default lists of known OIDs, that can be selected using the build features.
18By default, the registry has no feature enabled, to avoid embedding a huge database in crates.
19
20It also declares constants for most of these OIDs.
21
22```rust
23use oid_registry::OidRegistry;
24
25let mut registry = OidRegistry::default()
26    .with_crypto() // only if the 'crypto' feature is enabled
27;
28
29let e = registry.get(&oid_registry::OID_PKCS1_SHA256WITHRSA);
30if let Some(entry) = e {
31    // get sn: sha256WithRSAEncryption
32    println!("sn: {}", entry.sn());
33    // get description: SHA256 with RSA encryption
34    println!("description: {}", entry.description());
35}
36
37```
38
39## Extending the registry
40
41These provided lists are often incomplete, or may lack some specific OIDs.
42This is why the registry allows adding new entries after construction:
43
44```rust
45use oid_registry::{OidEntry, OidRegistry};
46use der_parser::oid;
47
48let mut registry = OidRegistry::default();
49
50// entries can be added by creating an OidEntry object:
51let entry = OidEntry::new("shortName", "description");
52registry.insert(oid!(1.2.3.4), entry);
53
54// when using static strings, a tuple can also be used directly for the entry:
55registry.insert(oid!(1.2.3.5), ("shortName", "A description"));
56
57```
58
59## Contributing OIDs
60
61All OID values, constants, and features are derived from files in the `assets` directory in the
62build script (see `build.rs`).
63See `load_file` for documentation of the file format.
64<!-- cargo-sync-readme end -->
65
66## Rust version requirements
67
68`oid-registry` requires **Rustc version 1.45 or greater**, based on proc-macro
69attributes support.
70
71# License
72
73Licensed under either of
74
75 * Apache License, Version 2.0
76   ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
77 * MIT license
78   ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
79
80at your option.
81
82## Contribution
83
84Unless you explicitly state otherwise, any contribution intentionally submitted
85for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
86dual licensed as above, without any additional terms or conditions.
87