pub struct Asn1StringRef(/* private fields */);Expand description
A reference to an Asn1String.
Implementations§
Source§impl Asn1StringRef
impl Asn1StringRef
Sourcepub fn as_utf8(&self) -> Result<OpensslString, ErrorStack>
👎Deprecated since 0.10.81: truncates at the first interior NUL byte; use to_string instead
pub fn as_utf8(&self) -> Result<OpensslString, ErrorStack>
truncates at the first interior NUL byte; use to_string instead
Converts the ASN.1 underlying format to UTF8
ASN.1 strings may utilize UTF-16, ASCII, BMP, or UTF8. This is important to consume the string in a meaningful way without knowing the underlying format.
This corresponds to ASN1_STRING_to_UTF8.
Sourcepub fn to_string(&self) -> Result<String, ErrorStack>
pub fn to_string(&self) -> Result<String, ErrorStack>
Converts the ASN.1 underlying format to a UTF-8 string.
ASN.1 strings may utilize UTF-16, ASCII, BMP, or UTF8. This is important to consume the string in a meaningful way without knowing the underlying format.
The full contents of the string are preserved, including any interior NUL bytes. Any bytes that do not form valid UTF-8 after conversion are replaced with U+FFFD.
This corresponds to ASN1_STRING_to_UTF8.
Sourcepub fn as_slice(&self) -> &[u8] ⓘ
pub fn as_slice(&self) -> &[u8] ⓘ
Return the string as an array of bytes.
The bytes do not directly correspond to UTF-8 encoding. To interact with
strings in rust, it is preferable to use to_string
This corresponds to ASN1_STRING_get0_data.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of bytes in the string.
This corresponds to ASN1_STRING_length.