pub struct KeyPair { /* private fields */ }
Expand description
A key-pair, consisting of a CertificateChain
and PrivateKey
.
Implementations§
§impl KeyPair
impl KeyPair
pub fn new_self_signed<S>(domain: S) -> KeyPair
pub fn new_self_signed<S>(domain: S) -> KeyPair
Generate a self signed certificate.
pub fn from_parts(
certificate_chain: CertificateChain,
private_key: PrivateKey
) -> Result<KeyPair, KeyPair>
pub fn from_parts( certificate_chain: CertificateChain, private_key: PrivateKey ) -> Result<KeyPair, KeyPair>
Builds a new KeyPair
from the given CertificateChain
and
PrivateKey
. Will validate if they pair up correctly.
This presumes that CertificateChain
and PrivateKey
are valid,
see CertificateChain::from_certificates
and
PrivateKey::from_der
.
Errors
TODO: this doesn’t do any validation yet
pub fn unchecked_from_parts(
certificate_chain: CertificateChain,
private_key: PrivateKey
) -> KeyPair
pub fn unchecked_from_parts( certificate_chain: CertificateChain, private_key: PrivateKey ) -> KeyPair
Build KeyPair
from the given CertificateChain
and
PrivateKey
. This skips the validation from
from_parts
, which isn’t unsafe
, but could fail
nonetheless when used on an Endpoint
.
pub const fn certificate_chain(&self) -> &CertificateChain
pub const fn certificate_chain(&self) -> &CertificateChain
Return the CertificateChain
of this KeyPair
.
pub fn end_entity_certificate(&self) -> &Certificate
pub fn end_entity_certificate(&self) -> &Certificate
Returns the end-entity Certificate
.
Panics
If the KeyPair
is invalid. This can’t happen if validated
through from_parts
.
pub const fn private_key(&self) -> &PrivateKey
pub const fn private_key(&self) -> &PrivateKey
Return the secret PrivateKey
of this KeyPair
.
pub fn into_parts(self) -> (CertificateChain, PrivateKey)
pub fn into_parts(self) -> (CertificateChain, PrivateKey)
Destructure KeyPair
into it’s owned parts.
pub const fn parts(&self) -> (&CertificateChain, &PrivateKey)
pub const fn parts(&self) -> (&CertificateChain, &PrivateKey)
Destructure KeyPair
into it’s borrowed parts.
Trait Implementations§
§impl<'de> Deserialize<'de> for KeyPair
impl<'de> Deserialize<'de> for KeyPair
§fn deserialize<__D>(
__deserializer: __D
) -> Result<KeyPair, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<KeyPair, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Dangerous for KeyPair
impl Dangerous for KeyPair
§fn serialize<S>(
key_pair: &KeyPair,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
key_pair: &KeyPair,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
§impl Ord for KeyPair
impl Ord for KeyPair
§impl PartialOrd for KeyPair
impl PartialOrd for KeyPair
§fn partial_cmp(&self, other: &KeyPair) -> Option<Ordering>
fn partial_cmp(&self, other: &KeyPair) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more§impl TryFrom<(CertificateChain, PrivateKey)> for KeyPair
impl TryFrom<(CertificateChain, PrivateKey)> for KeyPair
§fn try_from(
_: (CertificateChain, PrivateKey)
) -> Result<KeyPair, <KeyPair as TryFrom<(CertificateChain, PrivateKey)>>::Error>
fn try_from( _: (CertificateChain, PrivateKey) ) -> Result<KeyPair, <KeyPair as TryFrom<(CertificateChain, PrivateKey)>>::Error>
impl Eq for KeyPair
impl StructuralEq for KeyPair
impl StructuralPartialEq for KeyPair
Auto Trait Implementations§
impl RefUnwindSafe for KeyPair
impl Send for KeyPair
impl Sync for KeyPair
impl Unpin for KeyPair
impl UnwindSafe for KeyPair
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> CallHasher for T
impl<T> CallHasher for T
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.