Skip to main content

DistinguishedName

Struct DistinguishedName 

Source
pub struct DistinguishedName<'a> { /* private fields */ }
Available on crate feature rustcrypto only.
Expand description

A distinguished name: up to MAX_RDNS attributes, in order.

Implementations§

Source§

impl<'a> DistinguishedName<'a>

Source

pub const fn new() -> Self

An empty name. A certificate with one is invalid — the schema says length 1.. — but building one up starts here.

Source

pub fn push(&mut self, attribute: DnAttribute<'a>) -> Result<()>

Appends an attribute.

Returns ErrorCode::CertInvalid past MAX_RDNS, because §6.5.6.3 makes that a rejection rather than a truncation.

Source

pub fn attributes(&self) -> &[DnAttribute<'a>]

The attributes, in encoding order.

Source

pub fn len(&self) -> usize

How many attributes there are.

Source

pub fn is_empty(&self) -> bool

Whether there are none.

Source

pub fn count(&self, kind: DnAttributeKind) -> usize

How many attributes of a kind there are.

Source

pub fn single_uint(&self, kind: DnAttributeKind) -> Option<u64>

The scalar of the single attribute of this kind, or None if there is not exactly one.

“Not exactly one” rather than “the first”: a subject with two matter-fabric-id attributes is invalid, and answering with either one would hide that.

Source

pub fn node_id(&self) -> Option<NodeId>

The matter-node-id, if the DN carries exactly one.

Source

pub fn fabric_id(&self) -> Option<FabricId>

The matter-fabric-id, if the DN carries exactly one.

Source

pub fn noc_cats(&self) -> Vec<CaseAuthenticatedTag, MAX_NOC_CATS>

Every matter-noc-cat in the DN, in order.

Source

pub fn encode(&self, writer: &mut TlvWriter<'_>, tag: Tag) -> Result<()>

Writes the DN as a LIST under tag.

Source

pub fn decode(reader: &mut TlvReader<'a>) -> Result<Self>

Reads a DN from a reader positioned just after the opening of its list.

Trait Implementations§

Source§

impl<'a> Clone for DistinguishedName<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for DistinguishedName<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Default for DistinguishedName<'a>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a> Eq for DistinguishedName<'a>

Source§

impl<'a> PartialEq for DistinguishedName<'a>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a> StructuralPartialEq for DistinguishedName<'a>

Auto Trait Implementations§

§

impl<'a> Forget for DistinguishedName<'a>

§

impl<'a> Freeze for DistinguishedName<'a>

§

impl<'a> Move for DistinguishedName<'a>

§

impl<'a> RefUnwindSafe for DistinguishedName<'a>

§

impl<'a> Send for DistinguishedName<'a>

§

impl<'a> Sync for DistinguishedName<'a>

§

impl<'a> Unpin for DistinguishedName<'a>

§

impl<'a> UnsafeUnpin for DistinguishedName<'a>

§

impl<'a> UnwindSafe for DistinguishedName<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.