#[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
Other
A form defined elsewhere, kept as its identifier and its value.
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<'_>
impl GeneralName<'_>
Sourcepub fn matches(
&self,
other: &GeneralName<'_>,
execution: &Memory,
) -> Result<bool, ErrorCode>
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)?);