pub enum DirectoryString {
PrintableString(PrintableString),
TeletexString(TeletexString),
Utf8String(String),
BmpString(BmpString),
}Expand description
DirectoryString as defined in RFC 5280 Section 4.2.1.4.
ASN.1 structure for DirectoryString is below.
DirectoryString ::= CHOICE {
teletexString TeletexString (SIZE (1..MAX)),
printableString PrintableString (SIZE (1..MAX)),
universalString UniversalString (SIZE (1..MAX)),
utf8String UTF8String (SIZE (1..MAX)),
bmpString BMPString (SIZE (1..MAX))
}Further, RFC 5280 Section 4.2.1.4 states:
The DirectoryString type is defined as a choice of PrintableString,
TeletexString, BMPString, UTF8String, and UniversalString. CAs
conforming to this profile MUST use either the PrintableString or
UTF8String encoding of DirectoryString, with two exceptions. When
CAs have previously issued certificates with issuer fields with
attributes encoded using TeletexString, BMPString, or
UniversalString, then the CA MAY continue to use these encodings of
the DirectoryString to preserve backward compatibility. Also, new
CAs that are added to a domain where existing CAs issue certificates
with issuer fields with attributes encoded using TeletexString,
BMPString, or UniversalString MAY encode attributes that they share
with the existing CAs using the same encodings as the existing CAs
use.The implication of the above paragraph is that PrintableString and
UTF8String are the new types and the other types are legacy. Until
the need arises, we only support PrintableString and UTF8String.
Variants§
PrintableString(PrintableString)
TeletexString(TeletexString)
Utf8String(String)
BmpString(BmpString)
Implementations§
Source§impl DirectoryString
impl DirectoryString
Sourcepub fn value(&self) -> Cow<'_, str>
pub fn value(&self) -> Cow<'_, str>
Returns Borrowed variant for UTF-8 compatible strings
and Owned variant otherwise.
Sourcepub fn as_ref(&self) -> &str
👎Deprecated since 0.3.0-pre.0: use DirectoryString::value instead
pub fn as_ref(&self) -> &str
use DirectoryString::value instead
Returns &str for PrintableString, TeletexString and Utf8String
Warning: Returns "" empty string for DirectoryString::BmpString variant
Trait Implementations§
Source§impl<'__der_lifetime> Choice<'__der_lifetime> for DirectoryString
impl<'__der_lifetime> Choice<'__der_lifetime> for DirectoryString
Source§impl Clone for DirectoryString
impl Clone for DirectoryString
Source§impl Debug for DirectoryString
impl Debug for DirectoryString
Source§impl<'__der_lifetime> Decode<'__der_lifetime> for DirectoryString
impl<'__der_lifetime> Decode<'__der_lifetime> for DirectoryString
Source§impl<'__der_lifetime> DecodeValue<'__der_lifetime> for DirectoryString
impl<'__der_lifetime> DecodeValue<'__der_lifetime> for DirectoryString
Source§impl<'__der_lifetime> EncodeValue for DirectoryString
impl<'__der_lifetime> EncodeValue for DirectoryString
impl Eq for DirectoryString
Source§impl From<DirectoryString> for String
impl From<DirectoryString> for String
Source§fn from(value: DirectoryString) -> Self
fn from(value: DirectoryString) -> Self
Converts to this type from the input type.
Source§impl<'__der_lifetime> IsConstructed for DirectoryString
impl<'__der_lifetime> IsConstructed for DirectoryString
Source§const CONSTRUCTED: bool = true
const CONSTRUCTED: bool = true
ASN.1 constructed bit
Source§impl PartialEq for DirectoryString
impl PartialEq for DirectoryString
impl StructuralPartialEq for DirectoryString
Source§impl<'__der_lifetime> Tagged for DirectoryString
impl<'__der_lifetime> Tagged for DirectoryString
Source§impl<'a> TryFrom<&'a Any> for DirectoryString
impl<'a> TryFrom<&'a Any> for DirectoryString
Auto Trait Implementations§
impl Freeze for DirectoryString
impl RefUnwindSafe for DirectoryString
impl Send for DirectoryString
impl Sync for DirectoryString
impl Unpin for DirectoryString
impl UnsafeUnpin for DirectoryString
impl UnwindSafe for DirectoryString
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> DecodeOwned for Twhere
T: for<'a> Decode<'a>,
Source§impl<T> Encode for T
impl<T> Encode for T
Source§fn encoded_len(&self) -> Result<Length, Error>
fn encoded_len(&self) -> Result<Length, Error>
Compute the length of this TLV object in bytes when encoded as ASN.1 DER. Read more
Source§fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
Encode this TLV object to the provided byte slice, returning a sub-slice
containing the encoded message. Read more