Struct DistinguishedName
pub struct DistinguishedName(/* private fields */);Available on crate feature
tls only.Expand description
A DistinguishedName is a Vec<u8> wrapped in internal types.
It contains the DER or BER encoded Subject field from RFC 5280
for a single certificate. The Subject field is encoded as an RFC 5280 Name.
It can be decoded using x509-parser’s FromDer trait.
ⓘ
for name in distinguished_names {
use x509_parser::prelude::FromDer;
println!("{}", x509_parser::x509::X509Name::from_der(&name.0)?.1);
}The TLS encoding is defined in RFC5246: opaque DistinguishedName<1..2^16-1>;
Implementations§
§impl DistinguishedName
impl DistinguishedName
pub fn in_sequence(bytes: &[u8]) -> DistinguishedName
pub fn in_sequence(bytes: &[u8]) -> DistinguishedName
Create a DistinguishedName after prepending its outer SEQUENCE encoding.
This can be decoded using x509-parser’s FromDer trait.
ⓘ
use x509_parser::prelude::FromDer;
println!("{}", x509_parser::x509::X509Name::from_der(dn.as_ref())?.1);Trait Implementations§
§impl AsRef<[u8]> for DistinguishedName
impl AsRef<[u8]> for DistinguishedName
§impl Clone for DistinguishedName
impl Clone for DistinguishedName
§fn clone(&self) -> DistinguishedName
fn clone(&self) -> DistinguishedName
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for DistinguishedName
impl Debug for DistinguishedName
§impl From<Vec<u8>> for DistinguishedName
impl From<Vec<u8>> for DistinguishedName
§fn from(v: Vec<u8>) -> DistinguishedName
fn from(v: Vec<u8>) -> DistinguishedName
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for DistinguishedName
impl RefUnwindSafe for DistinguishedName
impl Send for DistinguishedName
impl Sync for DistinguishedName
impl Unpin for DistinguishedName
impl UnwindSafe for DistinguishedName
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
Converts
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>
Converts
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