Lines Matching full:oid
3 //! All OID objects and definitions are now stored in the [oid-registry](https://crates.io/crates/o…
5 //! This crate is re-exporting `oid-registry`, so to access the OID constants the
10 //! To get the short name for a given OID:
16 //! let oid = &OID_X509_COMMON_NAME;
17 //! let sn = oid2sn(oid, oid_registry());
22 use der_parser::oid::Oid;
33 static ref ABBREV_MAP: HashMap<Oid<'static>, &'static str> = {
47 /// Return the abbreviation (for ex. CN for Common Name), or if not found, the OID short name
48 pub fn oid2abbrev<'a>(oid: &'a Oid, registry: &'a OidRegistry) -> Result<&'a str, NidError> { in oid2abbrev() argument
49 if let Some(abbrev) = ABBREV_MAP.get(oid) { in oid2abbrev()
52 registry.get(oid).map(|entry| entry.sn()).ok_or(NidError) in oid2abbrev()
55 /// Returns the short name corresponding to the OID
56 pub fn oid2sn<'a>(oid: &'a Oid, registry: &'a OidRegistry) -> Result<&'a str, NidError> { in oid2sn() argument
57 registry.get(oid).map(|o| o.sn()).ok_or(NidError) in oid2sn()
60 /// Returns the description corresponding to the OID
61 pub fn oid2description<'a>(oid: &'a Oid, registry: &'a OidRegistry) -> Result<&'a str, NidError> { in oid2description() argument
62 registry.get(oid).map(|o| o.description()).ok_or(NidError) in oid2description()
73 use der_parser::oid;
75 // This test is meant to check syntax of pattern matching with OID objects
78 let oid = oid!(1.2.840 .113549 .1 .1 .5); in test_oid_match() localVariable
79 if oid == OID_PKCS1_SHA1WITHRSA { in test_oid_match()
85 // match oid { in test_oid_match()