Struct Oid
pub struct Oid<'a> { /* private fields */ }crypto only.Expand description
Object ID (OID) representation which can be relative or non-relative.
An example for an OID in string representation is "1.2.840.113549.1.1.5".
For non-relative OIDs restrictions apply to the first two components.
This library contains a procedural macro oid which can be used to
create oids. For example oid!(1.2.44.233) or oid!(rel 44.233)
for relative oids. See the module documentation for more information.
Implementations§
§impl<'a> Oid<'a>
impl<'a> Oid<'a>
pub const fn new(asn1: Cow<'a, [u8]>) -> Oid<'a>
Available on (crate features rustls or boring or acme) and crate feature rustls only.
pub const fn new(asn1: Cow<'a, [u8]>) -> Oid<'a>
rustls or boring or acme) and crate feature rustls only.Create an OID from the ASN.1 DER encoded form. See the module documentation for other ways to create oids.
pub const fn new_relative(asn1: Cow<'a, [u8]>) -> Oid<'a>
Available on (crate features rustls or boring or acme) and crate feature rustls only.
pub const fn new_relative(asn1: Cow<'a, [u8]>) -> Oid<'a>
rustls or boring or acme) and crate feature rustls only.Create a relative OID from the ASN.1 DER encoded form. See the module documentation for other ways to create relative oids.
pub fn from(s: &[u64]) -> Result<Oid<'static>, OidParseError>
Available on (crate features rustls or boring or acme) and crate feature rustls only.
pub fn from(s: &[u64]) -> Result<Oid<'static>, OidParseError>
rustls or boring or acme) and crate feature rustls only.Build an OID from an array of object identifier components. This method allocates memory on the heap.
pub fn from_relative(s: &[u64]) -> Result<Oid<'static>, OidParseError>
Available on (crate features rustls or boring or acme) and crate feature rustls only.
pub fn from_relative(s: &[u64]) -> Result<Oid<'static>, OidParseError>
rustls or boring or acme) and crate feature rustls only.Build a relative OID from an array of object identifier components.
pub fn to_owned(&self) -> Oid<'static>
Available on (crate features rustls or boring or acme) and crate feature rustls only.
pub fn to_owned(&self) -> Oid<'static>
rustls or boring or acme) and crate feature rustls only.Create a deep copy of the oid.
This method allocates data on the heap. The returned oid can be used without keeping the ASN.1 representation around.
Cloning the returned oid does again allocate data.
pub fn as_bytes(&self) -> &[u8] ⓘ
Available on (crate features rustls or boring or acme) and crate feature rustls only.
pub fn as_bytes(&self) -> &[u8] ⓘ
rustls or boring or acme) and crate feature rustls only.Get the encoded oid without the header.
pub fn bytes(&self) -> &[u8] ⓘ
👎Deprecated since 0.2.0: Use as_bytes insteadAvailable on (crate features rustls or boring or acme) and crate feature rustls only.
pub fn bytes(&self) -> &[u8] ⓘ
as_bytes insteadrustls or boring or acme) and crate feature rustls only.Get the encoded oid without the header.
pub fn into_cow(self) -> Cow<'a, [u8]>
Available on (crate features rustls or boring or acme) and crate feature rustls only.
pub fn into_cow(self) -> Cow<'a, [u8]>
rustls or boring or acme) and crate feature rustls only.Get the bytes representation of the encoded oid
pub fn to_id_string(&self) -> String
Available on (crate features rustls or boring or acme) and crate feature rustls and non-crate feature bigint only.
pub fn to_id_string(&self) -> String
rustls or boring or acme) and crate feature rustls and non-crate feature bigint only.Convert the OID to a string representation.
If every arc fits into a u64 a string like “1.2.840.113549.1.1.5” is returned, otherwise a hex representation.
See also the “bigint” feature of this crate.
pub fn iter(&self) -> Option<impl FusedIterator + ExactSizeIterator>
Available on (crate features rustls or boring or acme) and crate feature rustls only.
pub fn iter(&self) -> Option<impl FusedIterator + ExactSizeIterator>
rustls or boring or acme) and crate feature rustls only.Return an iterator over the sub-identifiers (arcs).
Returns None if at least one arc does not fit into u64.
pub fn from_ber_relative( bytes: &'a [u8], ) -> Result<(&'a [u8], Oid<'a>), Err<Error>>
rustls or boring or acme) and crate feature rustls only.pub fn from_der_relative( bytes: &'a [u8], ) -> Result<(&'a [u8], Oid<'a>), Err<Error>>
rustls or boring or acme) and crate feature rustls only.pub fn starts_with(&self, needle: &Oid<'_>) -> bool
Available on (crate features rustls or boring or acme) and crate feature rustls only.
pub fn starts_with(&self, needle: &Oid<'_>) -> bool
rustls or boring or acme) and crate feature rustls only.Returns true if needle is a prefix of the OID.
Trait Implementations§
§impl CheckDerConstraints for Oid<'_>
impl CheckDerConstraints for Oid<'_>
§impl ToDer for Oid<'_>
Available on crate feature std only.
impl ToDer for Oid<'_>
std only.§fn to_der_len(&self) -> Result<usize, Error>
fn to_der_len(&self) -> Result<usize, Error>
§fn write_der_header(
&self,
writer: &mut dyn Write,
) -> Result<usize, SerializeError>
fn write_der_header( &self, writer: &mut dyn Write, ) -> Result<usize, SerializeError>
§fn write_der_content(
&self,
writer: &mut dyn Write,
) -> Result<usize, SerializeError>
fn write_der_content( &self, writer: &mut dyn Write, ) -> Result<usize, SerializeError>
§fn to_der_vec(&self) -> Result<Vec<u8>, SerializeError>
fn to_der_vec(&self) -> Result<Vec<u8>, SerializeError>
Vec<u8>.§fn to_der_vec_raw(&self) -> Result<Vec<u8>, SerializeError>
fn to_der_vec_raw(&self) -> Result<Vec<u8>, SerializeError>
to_vec, but uses provided values without changes.
This can generate an invalid encoding for a DER object.§fn write_der(&self, writer: &mut dyn Write) -> Result<usize, SerializeError>
fn write_der(&self, writer: &mut dyn Write) -> Result<usize, SerializeError>
§fn write_der_raw(&self, writer: &mut dyn Write) -> Result<usize, SerializeError>
fn write_der_raw(&self, writer: &mut dyn Write) -> Result<usize, SerializeError>
to_der, but uses provided values without changes.
This can generate an invalid encoding for a DER object.impl DerAutoDerive for Oid<'_>
impl<'a> Eq for Oid<'a>
impl<'a> StructuralPartialEq for Oid<'a>
Auto Trait Implementations§
impl<'a> Freeze for Oid<'a>
impl<'a> RefUnwindSafe for Oid<'a>
impl<'a> Send for Oid<'a>
impl<'a> Sync for Oid<'a>
impl<'a> Unpin for Oid<'a>
impl<'a> UnwindSafe for Oid<'a>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Choice for Twhere
T: Tagged,
impl<T> Choice for Twhere
T: Tagged,
§fn can_decode(tag: Tag) -> bool
fn can_decode(tag: Tag) -> bool
Tag decodable as a variant of this CHOICE?§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<'a, T, E> FromDer<'a, E> for Twhere
T: TryFrom<Any<'a>, Error = E> + CheckDerConstraints + DerAutoDerive,
E: From<Error> + Display + Debug,
impl<'a, T, E> FromDer<'a, E> for Twhere
T: TryFrom<Any<'a>, Error = E> + CheckDerConstraints + DerAutoDerive,
E: From<Error> + Display + Debug,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
fn rama_try_from(value: T) -> Result<U, <U as RamaTryFrom<T>>::Error>
§impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
type Error = <U as RamaTryFrom<T, CrateMarker>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>
§impl<T> ToSmolStr for T
impl<T> ToSmolStr for T
fn to_smolstr(&self) -> SmolStr
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.