#oid #asn1 #x500

no-std oid

Rust-native library for building, parsing, and formating Object Identifiers (OIDs)

4 releases

0.2.1 Sep 19, 2020
0.2.0 Sep 3, 2020
0.1.1 Oct 25, 2019
0.1.0 Jul 24, 2019

#87 in Cryptography

Download history 1285/week @ 2021-07-06 906/week @ 2021-07-13 1084/week @ 2021-07-20 741/week @ 2021-07-27 789/week @ 2021-08-03 1084/week @ 2021-08-10 914/week @ 2021-08-17 695/week @ 2021-08-24 1036/week @ 2021-08-31 1144/week @ 2021-09-07 1151/week @ 2021-09-14 1079/week @ 2021-09-21 999/week @ 2021-09-28 962/week @ 2021-10-05 1097/week @ 2021-10-12 1879/week @ 2021-10-19

4,965 downloads per month
Used in 6 crates (5 directly)

MIT/Apache

35KB
706 lines

Object Identifier Library for Rust

All Contributors

Build Status Crate codecov API Minimum rustc version Average time to resolve an issue Percentage of issues still open

Object Identifiers are a standard of the ITU used to reference objects, things, and concepts in a globally unique way. This crate provides for data structures and methods to build, parse, and format OIDs.

Basic Utilization

Running Example

You can run the example code from examples/basic.rs using cargo:

cargo run --example basic

Parsing OID String Representation

use oid::prelude::*;
let oid = ObjectIdentifier::try_from("0.1.2.3")?;

Parsing OID Binary Representation

use oid::prelude::*;
let oid = ObjectIdentifier::try_from(vec![0x00, 0x01, 0x02, 0x03])?;

Encoding OID as String Representation

use oid::prelude::*;
let oid = ObjectIdentifier::try_from("0.1.2.3")?;
let oid: String = oid.into();
assert_eq!(oid, "0.1.2.3");

Encoding OID as Binary Representation

use oid::prelude::*;
let oid = ObjectIdentifier::try_from(vec![0x00, 0x01, 0x02, 0x03])?;
let oid: Vec<u8> = oid.into();
assert_eq!(oid, "0.1.2.3");

Adding as a dependency with cargo-edit

cargo add oid

Adding as a dependency with cargo-edit for a !#[no_std] crate

cargo add oid --no-default-features

Adding as a dependency directly to Cargo.toml

[dependencies]
oid = "0.1.0"

Adding as a dependency directly to Cargo.toml for a !#[no_std] crate

[dependencies]
oid = { default-features = false }

Building

The build routines have been automated with cargo-make. If you're not using cargo-make, you can check [Makefile.toml] for the relevant manual build procedures.

Building for a platform with Rust Standard Library

cargo make

Building for an embedded platform or #![no_std]

cargo make build_no_std

Fuzzing Inputs

Profiles for cargo-fuzz are included for fuzzing the inputs on public method parameters.

Fuzz Binary OID Parsing

cargo make fuzz_parse_binary

Fuzz String OID Parsing

cargo make fuzz_parse_string

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Sean Bruton
Sean Bruton

⚠️ 💻
Benoît C.
Benoît C.

⚠️ 💻
snake66
snake66

⚠️ 💻

This project follows the all-contributors specification. Contributions of any kind welcome!

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this library by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~66KB