Skip to main content

GeneralName

Enum GeneralName 

Source
#[non_exhaustive]
pub enum GeneralName<'a> { Other { type_id: Oid<'a>, value: &'a [u8], }, Email(&'a str), Dns(&'a str), X400(&'a [u8]), Directory(Name<'a>), EdiParty(&'a [u8]), Uri(&'a str), IpAddress(&'a [u8]), RegisteredId(Oid<'a>), }
Expand description

One name, in whichever of the forms the schema allows.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Other

A form defined elsewhere, kept as its identifier and its value.

Fields

§type_id: Oid<'a>

What kind of name this is.

§value: &'a [u8]

The value, as it was encoded.

§

Email(&'a str)

An electronic mail address.

§

Dns(&'a str)

A domain name.

§

X400(&'a [u8])

An X.400 address, kept as encoded because nothing here reads one.

§

Directory(Name<'a>)

A distinguished name, the same kind a certificate’s subject is.

§

EdiParty(&'a [u8])

An EDI party name, kept as encoded.

§

Uri(&'a str)

A location, which is text and is never fetched.

§

IpAddress(&'a [u8])

An address, as the four or sixteen bytes it is written in. In a name constraint this is twice that, the address and then its mask.

§

RegisteredId(Oid<'a>)

A name that is itself an identifier.

Implementations§

Source§

impl GeneralName<'_>

Source

pub fn matches( &self, other: &GeneralName<'_>, execution: &Memory, ) -> Result<bool, ErrorCode>

Compares retained names in the current request’s execution account.

DNS and ASCII mailbox identities use RFC5280 §§7.2/7.5 as updated by RFC9549; Directory names use Name::matches, and URIs use §7.4 normalization. Other, X.400 and EDI values have encoded identity only; their type-specific semantic matching rules are not implemented here. IP addresses and masks compare exactly, without subnet containment. This query does not establish that a caller-constructed value was decoded successfully. Decode untrusted names with read first.

§Errors

Resource refusal remains an error, rather than a mismatch. A retained value carries no universal document span, so this query returns an unlocated error code. Producing reads use [matches] for location.

§Examples
use std::sync::Arc;
use structured_asn1::memory::{Memory, MemoryAccount};
use structured_pkix::general_name::GeneralName;
let execution = Memory::new(Arc::new(MemoryAccount::new(1024, 4096)));
assert!(GeneralName::Dns("EXAMPLE.COM").matches(&GeneralName::Dns("example.com"), &execution)?);

Trait Implementations§

Source§

impl<'a> Debug for GeneralName<'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 GeneralName<'a>

§

impl<'a> RefUnwindSafe for GeneralName<'a>

§

impl<'a> Send for GeneralName<'a>

§

impl<'a> Sync for GeneralName<'a>

§

impl<'a> Unpin for GeneralName<'a>

§

impl<'a> UnsafeUnpin for GeneralName<'a>

§

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