pub struct CertificateAuthority { /* private fields */ }Expand description
Wraps a CA certificate and key pair used to sign per-host certificates.
Implementations§
Source§impl CertificateAuthority
impl CertificateAuthority
Sourcepub fn from_pem(cert_pem: &str, key_pem: &str) -> Result<Self, Error>
pub fn from_pem(cert_pem: &str, key_pem: &str) -> Result<Self, Error>
Create from PEM-encoded strings.
Sourcepub fn from_pem_files(
cert_path: impl AsRef<Path>,
key_path: impl AsRef<Path>,
) -> Result<Self, Error>
pub fn from_pem_files( cert_path: impl AsRef<Path>, key_path: impl AsRef<Path>, ) -> Result<Self, Error>
Create from PEM files on disk.
Sourcepub fn generate() -> Result<Self, Error>
pub fn generate() -> Result<Self, Error>
Generate a new self-signed CA certificate and key pair with CN "MITM CA".
Sourcepub fn generate_with_cn(cn: &str) -> Result<Self, Error>
pub fn generate_with_cn(cn: &str) -> Result<Self, Error>
Generate a new self-signed CA certificate and key pair with the given common name.
Sourcepub fn to_pem_files(
&self,
cert_path: impl AsRef<Path>,
key_path: impl AsRef<Path>,
) -> Result<(), Error>
pub fn to_pem_files( &self, cert_path: impl AsRef<Path>, key_path: impl AsRef<Path>, ) -> Result<(), Error>
Write the CA certificate and key as PEM files to disk.
Sourcepub fn generate_cert(
&self,
hostname: &str,
) -> Result<(CertificateDer<'static>, PrivateKeyDer<'static>), Error>
pub fn generate_cert( &self, hostname: &str, ) -> Result<(CertificateDer<'static>, PrivateKeyDer<'static>), Error>
Generate a leaf certificate for the given hostname, signed by this CA.
Auto Trait Implementations§
impl Freeze for CertificateAuthority
impl !RefUnwindSafe for CertificateAuthority
impl Send for CertificateAuthority
impl Sync for CertificateAuthority
impl Unpin for CertificateAuthority
impl UnsafeUnpin for CertificateAuthority
impl !UnwindSafe for CertificateAuthority
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§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
Mutably borrows from an owned value. Read more