pub struct KeyUsage { /* private fields */ }
Expand description
The expected key usage of a certificate.
This type represents the expected key usage of an end entity certificate. Although for most kinds of certificates the extended key usage extension is optional (and so certificates not carrying a particular value in the EKU extension are acceptable). If the extension is present, the certificate MUST only be used for one of the purposes indicated.
Implementations§
source§impl KeyUsage
impl KeyUsage
sourcepub const fn server_auth() -> Self
pub const fn server_auth() -> Self
Construct a new KeyUsage
as appropriate for server certificate authentication.
As specified in https://www.rfc-editor.org/rfc/rfc5280#section-4.2.1.12, this does not require the certificate to specify the eKU extension.
sourcepub const fn client_auth() -> Self
pub const fn client_auth() -> Self
Construct a new KeyUsage
as appropriate for client certificate authentication.
As specified in <>, this does not require the certificate to specify the eKU extension.
sourcepub const fn required(oid: &'static [u8]) -> Self
pub const fn required(oid: &'static [u8]) -> Self
Construct a new KeyUsage
requiring a certificate to support the specified OID.
sourcepub const fn required_if_present(oid: &'static [u8]) -> Self
pub const fn required_if_present(oid: &'static [u8]) -> Self
Construct a new KeyUsage
requiring a certificate to support the specified OID, if the certificate has EKUs.