pub struct KeyPair { /* private fields */ }
Expand description
A key-pair, consisting of a CertificateChain
and PrivateKey
.
Implementations§
source§impl KeyPair
impl KeyPair
sourcepub fn new_self_signed<S: Into<String>>(domain: S) -> Self
Available on crate feature rcgen
only.
pub fn new_self_signed<S: Into<String>>(domain: S) -> Self
rcgen
only.Generate a self signed certificate.
sourcepub fn from_parts(
certificate_chain: CertificateChain,
private_key: PrivateKey
) -> Result<Self, KeyPair>
pub fn from_parts( certificate_chain: CertificateChain, private_key: PrivateKey ) -> Result<Self, 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
sourcepub fn unchecked_from_parts(
certificate_chain: CertificateChain,
private_key: PrivateKey
) -> Self
pub fn unchecked_from_parts( certificate_chain: CertificateChain, private_key: PrivateKey ) -> Self
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
.
sourcepub const fn certificate_chain(&self) -> &CertificateChain
pub const fn certificate_chain(&self) -> &CertificateChain
Return the CertificateChain
of this KeyPair
.
sourcepub 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
.
sourcepub const fn private_key(&self) -> &PrivateKey
pub const fn private_key(&self) -> &PrivateKey
Return the secret PrivateKey
of this KeyPair
.
sourcepub fn into_parts(self) -> (CertificateChain, PrivateKey)
pub fn into_parts(self) -> (CertificateChain, PrivateKey)
Destructure KeyPair
into it’s owned parts.
sourcepub const fn parts(&self) -> (&CertificateChain, &PrivateKey)
pub const fn parts(&self) -> (&CertificateChain, &PrivateKey)
Destructure KeyPair
into it’s borrowed parts.
Trait Implementations§
source§impl<'de> Deserialize<'de> for KeyPair
impl<'de> Deserialize<'de> for KeyPair
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl Ord for KeyPair
impl Ord for KeyPair
source§impl PartialEq<KeyPair> for KeyPair
impl PartialEq<KeyPair> for KeyPair
source§impl PartialOrd<KeyPair> for KeyPair
impl PartialOrd<KeyPair> for KeyPair
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 moresource§impl TryFrom<(CertificateChain, PrivateKey)> for KeyPair
impl TryFrom<(CertificateChain, PrivateKey)> for KeyPair
source§fn try_from(
(certificate_chain, private_key): (CertificateChain, PrivateKey)
) -> Result<Self, Self::Error>
fn try_from( (certificate_chain, private_key): (CertificateChain, PrivateKey) ) -> Result<Self, Self::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
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.