pub struct Credentials<'a> {
pub certificate: CertificateDer<'a>,
pub private_key: PrivateKeyDer<'a>,
pub root_certs: Option<Vec<CertificateDer<'a>>>,
}Expand description
Stores the credentials needed for TLS connections
Fields§
§certificate: CertificateDer<'a>Public certificate in DER format
private_key: PrivateKeyDer<'a>Private key in DER format
root_certs: Option<Vec<CertificateDer<'a>>>Optional server root certificate
Implementations§
Source§impl<'a> Credentials<'a>
impl<'a> Credentials<'a>
Sourcepub fn from_unencrypted_pem(
certificate: Source,
private_key: Source,
root_certs: Option<Source>,
) -> Result<Self, Box<dyn Error>>
pub fn from_unencrypted_pem( certificate: Source, private_key: Source, root_certs: Option<Source>, ) -> Result<Self, Box<dyn Error>>
Creates Credentials from unencrypted PEM strings or files
§Arguments
certificate- PEM-encoded certificate or path to certificate fileprivate_key- PEM-encoded private key or path to private key fileroot_certs- Optional PEM-encoded root certificates or path to root certificates file
Sourcepub fn from_encrypted_pem(
certificate: Source,
private_key: Source,
root_certs: Option<Source>,
password: &str,
) -> Result<Self, Box<dyn Error>>
pub fn from_encrypted_pem( certificate: Source, private_key: Source, root_certs: Option<Source>, password: &str, ) -> Result<Self, Box<dyn Error>>
Creates Credentials from encrypted PEM strings or files
Note: This function currently does not support the Oid used by the default TakServer client certificates (OID: 1.2.840.113549.3.7). These certificates should be converted to unencrypted PEM format before use, or re-encrypted using a supported algorithm (see the pkcs8 crate / const-oid documentation for details).
§Arguments
certificate- PEM-encoded certificate or path to certificate fileprivate_key- PEM-encoded private key or path to private key fileroot_certs- Optional PEM-encoded root certificates or path to root certificates filepassword- Password to decrypt the private key
Auto Trait Implementations§
impl<'a> Freeze for Credentials<'a>
impl<'a> RefUnwindSafe for Credentials<'a>
impl<'a> Send for Credentials<'a>
impl<'a> Sync for Credentials<'a>
impl<'a> Unpin for Credentials<'a>
impl<'a> UnwindSafe for Credentials<'a>
Blanket Implementations§
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