Skip to main content

Name

Struct Name 

Source
pub struct Name<'a> { /* private fields */ }
Expand description

A distinguished name, as the sequence of parts the certificate holds.

Implementations§

Source§

impl Name<'_>

Source

pub fn rfc4514(&self, execution: &Memory) -> Result<OwnedString>

Formats a reversible RFC 4514 name, preserving every original value as #BER. Types use registered descriptors or exact numeric OIDs; RDN order is reversed as required by RFC 4514 §2.1. No value is truncated. The returned string independently retains its storage charge.

Source

pub fn rfc4514_readable(&self, execution: &Memory) -> Result<OwnedString>

Formats a complete readable RFC 4514 name. Known, fully decoded attribute syntax uses escaped text; unknown/nontext values use original #BER. Text follows the declared attribute syntax; matching remains a separate fallible operation. This form does not preserve the original ASN.1 string tag or promise a canonical identity string. This convenience form is for metadata; use rfc4514 for reversibility.

Source§

impl<'a> Name<'a>

Source

pub fn as_bytes(&self) -> &'a [u8] ⓘ

The name exactly as it was encoded, which is what identity is.

Source

pub fn parts(&self) -> &[RelativeName<'a>]

The parts, outermost first, as the certificate wrote them.

Source

pub fn is_empty(&self) -> bool

Whether the name has no parts at all, which a certificate is allowed to do when the subject is named somewhere else instead.

Source

pub fn try_copy(&self, execution: &Memory) -> Result<Self>

Copies descriptors into the current domain; document bytes remain borrowed.

§Errors

Returns a located resource error before unfunded copying or allocation.

Source

pub fn attributes(&self) -> impl Iterator<Item = &Attribute<'a>>

Every attribute, in the order the name holds them. The caller admits its own traversal of this borrowed view.

Source

pub fn attributes_of<'n, 'q, W: Work>( &'n self, kind: Oid<'q>, execution: &'q W, ) -> impl Iterator<Item = Result<&'n Attribute<'a>>> + 'q
where 'n: 'q,

The attributes of one kind, in order. Several is not an error: a name can carry more than one organizational unit, and which one matters is not this layer’s decision. Each search step is admitted in the current execution domain. A refusal is yielded once, after which repeated next() calls do no further work. Returned references borrow the name, independently of the budget borrow.

Source

pub fn attribute<W: Work>( &self, kind: Oid<'_>, execution: &W, ) -> Result<Option<&Attribute<'a>>>

The first attribute of one kind.

Source

pub fn common_name<W: Work>( &self, execution: &W, ) -> Result<Option<&Attribute<'a>>>

The common name, which describes the subject and does not identify it.

Source

pub fn organization_identifier<W: Work>( &self, execution: &W, ) -> Result<Option<&Attribute<'a>>>

The organization identifier, which is how a legal entity is identified rather than described, and is the attribute an attribution decision may rest on where the common name is not.

Source

pub fn matches<W: Work>(&self, other: &Name<'_>, execution: &W) -> Result<bool>

Whether two names are the same name, by the profile’s rule: the same parts in the same order, each holding the same attributes, with strings compared under their declared equality rule.

Directory strings are compared after the preparation the profile requires (RFC 5280 7.1, over RFC 4518): the characters that carry no meaning are dropped, case is folded in full, the value is normalized to form KC, and runs of space count as one between words and none at the edges. Unsupported types and nonconforming stored values retain their encoded identity; that preservation does not validate an LDAP assertion. Valid supported values use the schema’s size bounds and the current work/storage budget, independently of display truncation. IA5 emailAddress and domainComponent values instead use their exact ASCII case-insensitive rules without whitespace compression; the DN emailAddress rule covers the whole value, unlike rfc822Name mailboxes. Pseudonym uses caseExactMatch (RFC2985 §5.2.9): the same preparation and insignificant-space handling, with case preserved.

§Errors

Returns a located resource error before unfunded comparison work.

Source

pub fn matches_in( &self, other: &Name<'_>, parent: &Reader<'_, '_>, ) -> Result<bool>

Compares retained names under the current query reader’s execution.

Names may come from independently parsed certificates. Their storage stays on its original account; normalization/comparison scratch and deferred string decoding use the query’s local and aggregate ceilings. This is a comparison, not permission to reparse a foreign certificate.

Source

pub fn order<W: Work>( &self, other: &Name<'_>, execution: &W, ) -> Result<Ordering>

A total order over names that calls two of them equal exactly when Name::matches does.

It exists so that a set of names can be searched rather than walked. A caller holding many certificates and asking which one a name belongs to otherwise compares against every one of them, and comparing names is where the profile’s folding lives; ordering them once turns that into a search. Answering the same question two ways is only safe because this is the same comparison: it is built from the ordering the multiset matching already uses, not from a second reading of what identity is.

Preparation and comparison use the current execution domain. Unicode scratch storage is released when this comparison returns.

§Errors

Returns a located resource error before unfunded preparation or comparison.

Source

pub fn ordered<W: Work>(&self, execution: &W) -> Result<Ordered<'a, W>>

Prepares this name once for repeated comparisons.

Encoded values remain borrowed. Sorted descriptors and any Unicode canonical text retain their storage charge until this result is dropped. Comparisons subsequently use the execution domain passed to them.

§Errors

Returns a located resource error if preparation cannot be financed.

Source

pub fn ordered_in<'p>( &self, parent: &'p Reader<'_, '_>, ) -> Result<Ordered<'a, Execution<'p>>>

Prepares a cache inside the current producing operation’s work ceilings.

Original document values and their retained nesting depths remain intact. Deferred BER strings use the supplied reader’s session/account instead of a new Parser. Cache storage retains its current account; its work owner borrows the operation independently of the document’s lifetime. This is the same semantic order as Name::ordered, with scoped funding.

Source

pub fn starts_with<W: Work>( &self, base: &Name<'_>, execution: &W, ) -> Result<bool>

Whether this name sits below another one: the parts of the other, in order, from the top down, and anything at all after them.

This is the containment a name-constraint subtree asks about, where the base “specifies a subtree of the X.500 directory tree” and a name is within it when it begins with the base (RFC 5280 4.2.1.10). A base of no parts is the root of the tree and holds every name. Parts are compared by the rule identity uses, so a name sits below itself.

§Errors

Returns a located resource error before unfunded prefix preparation.

Trait Implementations§

Source§

impl<'a> Debug for Name<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !Freeze for Name<'a>

§

impl<'a> RefUnwindSafe for Name<'a>

§

impl<'a> Send for Name<'a>

§

impl<'a> Sync for Name<'a>

§

impl<'a> Unpin for Name<'a>

§

impl<'a> UnsafeUnpin for Name<'a>

§

impl<'a> UnwindSafe for Name<'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> 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, 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.