pub struct ClientIdentity { /* private fields */ }Expand description
Outbound TLS client identity, see the module docs.
Implementations§
Source§impl ClientIdentity
impl ClientIdentity
Sourcepub fn from_der(
certificates: &[&[u8]],
private_key: &[u8],
) -> Result<ClientIdentity, Error>
pub fn from_der( certificates: &[&[u8]], private_key: &[u8], ) -> Result<ClientIdentity, Error>
Loads a leaf-first DER certificate list and an unencrypted PKCS#8 key.
§Errors
See Identity::from_der. The resulting chain omits the self-signed root.
Sourcepub fn from_pem(
certificates: &[u8],
private_key: &[u8],
) -> Result<ClientIdentity, Error>
pub fn from_pem( certificates: &[u8], private_key: &[u8], ) -> Result<ClientIdentity, Error>
Loads PEM certificates and an unencrypted PKCS#8 key, without persisting native keys.
§Errors
See Identity::from_pem.
Sourcepub fn load(source: &IdentitySource) -> Result<ClientIdentity, Error>
pub fn load(source: &IdentitySource) -> Result<ClientIdentity, Error>
Loads the client identity.
§Errors
See IdentitySource::load; on Windows also Error::Backend if the chain cannot be
built and Error::Unsupported for key algorithms other than RSA and EC P-256/384/521.
On Unix, Error::InvalidIdentity if an issuer certificate or public key cannot be decoded.
Sourcepub fn from_pkcs12(der: &[u8], password: &str) -> Result<ClientIdentity, Error>
pub fn from_pkcs12(der: &[u8], password: &str) -> Result<ClientIdentity, Error>
Parses a DER PKCS#12 archive; on Windows the key is imported into CNG without persisting.
§Errors
Error::InvalidDer if the input is not a PKCS#12 archive,
Error::InvalidIdentity if the archive cannot be decrypted, has no key, or an issuer
certificate or public key cannot be decoded (Unix),
Error::Unsupported for unsupported key algorithms or unavailable PKCS#12 loading.
Sourcepub fn from_identity(id: Identity) -> Result<ClientIdentity, Error>
pub fn from_identity(id: Identity) -> Result<ClientIdentity, Error>
Converts an identity into a leaf-first client chain without a self-signed root.
§Errors
Sourcepub fn cert(&self) -> &Certificate
pub fn cert(&self) -> &Certificate
Leaf certificate.
Sourcepub fn chain(&self) -> &[Certificate]
pub fn chain(&self) -> &[Certificate]
Leaf first, then intermediates in issuer order; the self-signed root is not included.
Sourcepub fn private_key(&self) -> &PrivateKey
pub fn private_key(&self) -> &PrivateKey
Portable signing key; native keys need not be exportable.
Sourcepub fn private_key_pkcs8_der(&self) -> &[u8] ⓘ
pub fn private_key_pkcs8_der(&self) -> &[u8] ⓘ
PKCS#8 DER private key (non-Windows compatibility accessor). Never log it.
Trait Implementations§
Source§impl Clone for ClientIdentity
impl Clone for ClientIdentity
Source§fn clone(&self) -> ClientIdentity
fn clone(&self) -> ClientIdentity
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more