pub struct SerialNumber { /* private fields */ }Expand description
A Certificate serial number, potentially non-unique, set by the
certificate issuer.
X509 serial numbers are variable length byte arrays defined in RFC 5280 as up to 20 bytes (“octets”):
Certificate users MUST be able to handle serialNumber values up to 20 octets. Conforming CAs MUST NOT use serialNumber values longer than 20 octets.
This implementation accepts a serial number of arbitrary length as a byte array (as apposed to a using a fixed sized integer) up to a maximum of the specified 20 bytes. Users of this type MUST account for the variable length nature when storing or transmitting this value.
When rendered to a string (with Display or
SerialNumber::as_hex_str()) this type formats the serial number as a
colon delimited, lowercase hex string following the convention of the
OpenSSL representation of serial numbers (example:
cc:cb:0f:63:f1:63:5e:f1:0e:26:e8:82:f7:7a:6e:f9).
§Not Uniquely Identifying
Serial numbers are set by the certificate issuer. A certificate issuer
SHOULD use a unique serial number for each certificate it issues, but code
MUST NOT rely on a SerialNumber to uniquely identify a specific
certificate as it can be re-used if the issuer is compromised.
Implementations§
Source§impl SerialNumber
impl SerialNumber
Sourcepub fn as_hex_str(&self) -> &str
pub fn as_hex_str(&self) -> &str
Render the SerialNumber as a lowercase hex string delimited by
colons in the style of OpenSSL.
Example: cc:cb:0f:63:f1:63:5e:f1:0e:26:e8:82:f7:7a:6e:f9
This value is lazily rendered and cached for reuse.
Trait Implementations§
Source§impl Clone for SerialNumber
impl Clone for SerialNumber
Source§fn clone(&self) -> SerialNumber
fn clone(&self) -> SerialNumber
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SerialNumber
impl Debug for SerialNumber
Source§impl Display for SerialNumber
impl Display for SerialNumber
Source§impl<'a> From<&'a SerialNumber> for SerialNumber
impl<'a> From<&'a SerialNumber> for SerialNumber
Source§fn from(value: &'a SerialNumber) -> Self
fn from(value: &'a SerialNumber) -> Self
Source§impl<'a> From<&'a X509Certificate<'a>> for SerialNumber
impl<'a> From<&'a X509Certificate<'a>> for SerialNumber
Source§fn from(cert: &'a X509Certificate<'a>) -> Self
fn from(cert: &'a X509Certificate<'a>) -> Self
Source§impl Valuable for SerialNumber
Render a SerialNumber as an encoded string in structured logging.
impl Valuable for SerialNumber
Render a SerialNumber as an encoded string in structured logging.