[][src]Struct oid_registry::OidRegistry

pub struct OidRegistry { /* fields omitted */ }

Registry of known OIDs

Use OidRegistry::default() to create an empty registry. If the corresponding features have been selected, the with_xxx() methods can be used to add sets of known objets to the database.

Example

use der_parser::{oid, oid::Oid};
use oid_registry::{OidEntry, OidRegistry};

let mut registry = OidRegistry::default()
    .with_crypto() // only if the 'crypto' feature is enabled
;

// entries can be added by creating an OidEntry object:
let entry = OidEntry::new("shortName", "description");
registry.insert(oid!(1.2.3.4), entry);

// when using static strings, a tuple can also be used directly for the entry:
registry.insert(oid!(1.2.3.5), ("shortName", "A description"));

// To query an entry, use the `get` method:
const OID_1234: Oid<'static> = oid!(1.2.3.4);
let e = registry.get(&OID_1234);
assert!(e.is_some());
if let Some(e) = e {
    assert_eq!(e.sn(), "shortName");
}

Implementations

impl OidRegistry[src]

pub fn insert<E>(&mut self, oid: Oid<'static>, entry: E) -> Option<OidEntry> where
    E: Into<OidEntry>, 
[src]

Insert a new entry

pub fn get(&self, oid: &Oid<'static>) -> Option<&OidEntry>[src]

Returns a reference to the registry entry, if found for this OID.

pub fn keys(&self) -> impl Iterator<Item = &Oid<'static>>[src]

Return an Iterator over references to the OID numbers (registry keys)

pub fn values(&self) -> impl Iterator<Item = &OidEntry>[src]

Return an Iterator over references to the OidEntry values

pub fn iter(&self) -> impl Iterator<Item = (&Oid<'static>, &OidEntry)>[src]

Return an Iterator over references to the (Oid, OidEntry) key/value pairs

pub fn with_crypto(self) -> Self[src]

Populate registry with common crypto OIDs (encryption, hash algorithms)

pub fn with_all_crypto(self) -> Self[src]

Populate registry with all known crypto OIDs (encryption, hash algorithms, PKCS constants, etc.)

impl OidRegistry[src]

pub fn with_nist_algs(self) -> Self[src]

Load all known OIDs for feature nist_algs in the registry.

pub fn with_pkcs7(self) -> Self[src]

Load all known OIDs for feature pkcs7 in the registry.

pub fn with_kdf(self) -> Self[src]

Load all known OIDs for feature kdf in the registry.

pub fn with_x509(self) -> Self[src]

Load all known OIDs for feature x509 in the registry.

pub fn with_ms_spc(self) -> Self[src]

Load all known OIDs for feature ms_spc in the registry.

pub fn with_rsadsi(self) -> Self[src]

Load all known OIDs for feature rsadsi in the registry.

pub fn with_x962(self) -> Self[src]

Load all known OIDs for feature x962 in the registry.

pub fn with_pkcs9(self) -> Self[src]

Load all known OIDs for feature pkcs9 in the registry.

Trait Implementations

impl Debug for OidRegistry[src]

impl Default for OidRegistry[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.