pub struct EndpointKey {
pub validity: Duration,
/* private fields */
}Expand description
A key pair that identifies and authenticates an Endpoint.
Fields§
§validity: DurationHow long certificates should be valid for. Defaults to 2 minutes.
Implementations§
Source§impl EndpointKey
impl EndpointKey
Sourcepub fn generate_for(scheme: SigScheme) -> Result<Self, Error>
pub fn generate_for(scheme: SigScheme) -> Result<Self, Error>
Generate a new random key using a particular scheme.
Sourcepub fn load(key: KeyPair, scheme: SigScheme) -> Self
pub fn load(key: KeyPair, scheme: SigScheme) -> Self
Load an existing key from a rcgen::KeyPair.
Panics if scheme doesn’t match the keypair.
Methods from Deref<Target = KeyPair>§
Sourcepub fn algorithm(&self) -> &'static SignatureAlgorithm
pub fn algorithm(&self) -> &'static SignatureAlgorithm
Returns the key pair’s signature algorithm
Sourcepub fn public_key_raw(&self) -> &[u8] ⓘ
pub fn public_key_raw(&self) -> &[u8] ⓘ
Get the raw public key of this key pair
The key is in raw format, as how ring::signature::KeyPair::public_key
would output, and how ring::signature::UnparsedPublicKey::verify
would accept.
Sourcepub fn is_compatible(&self, signature_algorithm: &SignatureAlgorithm) -> bool
pub fn is_compatible(&self, signature_algorithm: &SignatureAlgorithm) -> bool
Check if this key pair can be used with the given signature algorithm
Sourcepub fn compatible_algs(
&self,
) -> impl Iterator<Item = &'static SignatureAlgorithm>
pub fn compatible_algs( &self, ) -> impl Iterator<Item = &'static SignatureAlgorithm>
Returns (possibly multiple) compatible SignatureAlgorithm’s
that the key can be used with
Sourcepub fn public_key_der(&self) -> Vec<u8> ⓘ
pub fn public_key_der(&self) -> Vec<u8> ⓘ
Return the key pair’s public key in DER format
The key is formatted according to the SubjectPublicKeyInfo struct of X.509. See RFC 5280 section 4.1.
Sourcepub fn public_key_pem(&self) -> String
pub fn public_key_pem(&self) -> String
Return the key pair’s public key in PEM format
The returned string can be interpreted with openssl pkey --inform PEM -pubout -pubin -text
Sourcepub fn serialize_der(&self) -> Vec<u8> ⓘ
pub fn serialize_der(&self) -> Vec<u8> ⓘ
Serializes the key pair (including the private key) in PKCS#8 format in DER
Panics if called on a remote key pair.
Sourcepub fn serialized_der(&self) -> &[u8] ⓘ
pub fn serialized_der(&self) -> &[u8] ⓘ
Returns a reference to the serialized key pair (including the private key) in PKCS#8 format in DER
Panics if called on a remote key pair.
Sourcepub fn as_remote(&self) -> Option<&(dyn RemoteKeyPair + Sync + Send)>
pub fn as_remote(&self) -> Option<&(dyn RemoteKeyPair + Sync + Send)>
Access the remote key pair if it is a remote one
Sourcepub fn serialize_pem(&self) -> String
pub fn serialize_pem(&self) -> String
Serializes the key pair (including the private key) in PKCS#8 format in PEM
Trait Implementations§
Source§impl Clone for EndpointKey
impl Clone for EndpointKey
Source§fn clone(&self) -> EndpointKey
fn clone(&self) -> EndpointKey
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more