Struct cryptographic_message_syntax::Oid
source · [−]Expand description
An object identifer.
Object identifiers are globally unique, hierarchical values that are used to identify objects or their type. When written, they are presented as a sequence of integers separated by dots such as ‘1.3.6.1.5.5.7.1’ or with the integers separated by white space and enclosed in curly braces such as ‘{ 1 3 6 1 5 5 7 1 }’. Individual integers or sequences of integers can also be given names which then are used instead of the integers.
Values of this type keep a single object identifer in its BER encoding,
i.e., in some form of byte sequence. Because different representations
may be useful, the type is actually generic over something that can
become a reference to a bytes slice. Parsing is only defined for Bytes
values, though.
The only use for object identifiers currently is to compare them to
predefined values. For this purpose, you typically define your known
object identifiers in a oid submodule as contants of
Oid<&'static [u8]> – or its type alias ConstOid. This is also the
reason why the wrapped value is pub for now. This will change once
const fn is stable.
Unfortunately, there is currently no proc macro to generate the object
identifier constants in the code. Instead, the crate ships with a
mkoid binary which accepts object identifiers in ‘dot integer’ notation
and produces the u8 array for their encoded value. You can install
this binary via cargo install ber.
Tuple Fields
0: TImplementations
sourceimpl Oid<Bytes>
impl Oid<Bytes>
sourcepub fn skip_in<S>(
cons: &mut Constructed<'_, S>
) -> Result<(), DecodeError<<S as Source>::Error>>where
S: Source,
pub fn skip_in<S>(
cons: &mut Constructed<'_, S>
) -> Result<(), DecodeError<<S as Source>::Error>>where
S: Source,
Skips over an object identifier value.
If the source has reached its end, if the next value does not have
the Tag::OID, or if it is not a primitive value, returns a malformed
error.
sourcepub fn skip_opt_in<S>(
cons: &mut Constructed<'_, S>
) -> Result<Option<()>, DecodeError<<S as Source>::Error>>where
S: Source,
pub fn skip_opt_in<S>(
cons: &mut Constructed<'_, S>
) -> Result<Option<()>, DecodeError<<S as Source>::Error>>where
S: Source,
Skips over an optional object identifier value.
If the source has reached its end of if the next value does not have
the Tag::OID, returns Ok(None). If the next value has the right
tag but is not a primitive value, returns a malformed error.
sourcepub fn take_from<S>(
constructed: &mut Constructed<'_, S>
) -> Result<Oid<Bytes>, DecodeError<<S as Source>::Error>>where
S: Source,
pub fn take_from<S>(
constructed: &mut Constructed<'_, S>
) -> Result<Oid<Bytes>, DecodeError<<S as Source>::Error>>where
S: Source,
Takes an object identifier value from the source.
If the source has reached its end, if the next value does not have
the Tag::OID, or if it is not a primitive value, returns a malformed
error.
sourcepub fn take_opt_from<S>(
constructed: &mut Constructed<'_, S>
) -> Result<Option<Oid<Bytes>>, DecodeError<<S as Source>::Error>>where
S: Source,
pub fn take_opt_from<S>(
constructed: &mut Constructed<'_, S>
) -> Result<Option<Oid<Bytes>>, DecodeError<<S as Source>::Error>>where
S: Source,
Takes an optional object identifier value from the source.
If the source has reached its end of if the next value does not have
the Tag::OID, returns Ok(None). If the next value has the right
tag but is not a primitive value, returns a malformed error.
Trait Implementations
sourceimpl From<DigestAlgorithm> for Oid<Bytes>
impl From<DigestAlgorithm> for Oid<Bytes>
sourcefn from(alg: DigestAlgorithm) -> Oid<Bytes>
fn from(alg: DigestAlgorithm) -> Oid<Bytes>
sourceimpl From<KeyAlgorithm> for Oid<Bytes>
impl From<KeyAlgorithm> for Oid<Bytes>
sourcefn from(alg: KeyAlgorithm) -> Oid<Bytes>
fn from(alg: KeyAlgorithm) -> Oid<Bytes>
sourceimpl From<SignatureAlgorithm> for Oid<Bytes>
impl From<SignatureAlgorithm> for Oid<Bytes>
sourcefn from(alg: SignatureAlgorithm) -> Oid<Bytes>
fn from(alg: SignatureAlgorithm) -> Oid<Bytes>
sourceimpl<T, U> PartialEq<Oid<U>> for Oid<T>where
T: AsRef<[u8]>,
U: AsRef<[u8]>,
impl<T, U> PartialEq<Oid<U>> for Oid<T>where
T: AsRef<[u8]>,
U: AsRef<[u8]>,
sourceimpl<T> PrimitiveContent for Oid<T>where
T: AsRef<[u8]>,
impl<T> PrimitiveContent for Oid<T>where
T: AsRef<[u8]>,
sourcefn encoded_len(&self, Mode) -> usize
fn encoded_len(&self, Mode) -> usize
sourcefn write_encoded<W>(&self, Mode, target: &mut W) -> Result<(), Error>where
W: Write,
fn write_encoded<W>(&self, Mode, target: &mut W) -> Result<(), Error>where
W: Write,
sourcefn to_encoded_bytes(&self, mode: Mode) -> Bytes
fn to_encoded_bytes(&self, mode: Mode) -> Bytes
sourcefn encode(self) -> Primitive<Self>
fn encode(self) -> Primitive<Self>
sourcefn encode_as(self, tag: Tag) -> Primitive<Self>
fn encode_as(self, tag: Tag) -> Primitive<Self>
sourcefn encode_ref(&self) -> Primitive<&Self>
fn encode_ref(&self) -> Primitive<&Self>
sourcefn encode_ref_as(&self, tag: Tag) -> Primitive<&Self>
fn encode_ref_as(&self, tag: Tag) -> Primitive<&Self>
impl<T> Eq for Oid<T>where
T: AsRef<[u8]>,
Auto Trait Implementations
impl<T> RefUnwindSafe for Oid<T>where
T: RefUnwindSafe,
impl<T> Send for Oid<T>where
T: Send,
impl<T> Sync for Oid<T>where
T: Sync,
impl<T> Unpin for Oid<T>where
T: Unpin,
impl<T> UnwindSafe for Oid<T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToHex for Twhere
T: AsRef<[u8]>,
impl<T> ToHex for Twhere
T: AsRef<[u8]>,
sourcefn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Lower case
letters are used (e.g. f9b4ca) Read moresourcefn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Upper case
letters are used (e.g. F9B4CA) Read more