pub struct ClientIdentity {
pub cert_chain_pem: Vec<u8>,
pub key_pem: Vec<u8>,
pub key_passphrase: Option<String>,
}Expand description
A client certificate and its private key, for TLS client authentication.
Both are PEM-encoded. A remote that authenticates its clients with TLS needs an identity.
Fields§
§cert_chain_pem: Vec<u8>The client certificate, followed by any intermediate certificates.
If the blob holds no certificate, Fetcher::new returns
Error::Fetch.
key_pem: Vec<u8>The private key of the client certificate.
The blob holds one section or more. The fetcher reads the first section whose armor label names a private key, and that section selects the path:
- A
PRIVATE KEY,RSA PRIVATE KEY, orEC PRIVATE KEYsection is read as it is. - An
ENCRYPTED PRIVATE KEYsection is PKCS#8 under PBES2.key_passphrasedecrypts it.
If the blob holds no private key section, Fetcher::new returns
Error::Fetch.
key_passphrase: Option<String>The passphrase of an encrypted PKCS#8 private key.
If this is set and the key section carries no encryption, the fetcher refuses the key. A passphrase that decrypts nothing hides a configuration mistake.
§Algorithms
- Ciphers: AES-128-CBC, AES-192-CBC, AES-256-CBC, AES-128-GCM, and AES-256-GCM.
- GCM parameters: a 12-byte nonce as a bare OCTET STRING. The 16-byte tag is at the end of the ciphertext.
- Key derivation functions: PBKDF2 with an HMAC-SHA-2 pseudorandom function, and scrypt.
§Key derivation cost
The key file sets the cost of the key derivation. The iteration count of PBKDF2 and the cost parameter of scrypt come from the file. A file with an extreme parameter uses that much processor time or memory. The operator supplies the key file, so ostrya applies no bound to either parameter.
§Refusals
Fetcher::new returns Error::Fetch, with a message of its own,
in each of these cases:
- The key is encrypted, and no passphrase is set.
- A passphrase is set, and the key section carries no encryption.
- The passphrase does not decrypt the key.
- This build has no implementation of the PBES2 cipher or key derivation function. The message names the OID. DES, 3DES, and PBKDF2 with an HMAC-SHA-1 pseudorandom function get this refusal.
- The key is under PKCS#5 PBES1, which the
pkcs5crate parses and does not decrypt. The message names PBES1.pkcs5recognizes six PBES1 OIDs, and an OID outside that set gives a DER decoding failure. A corrupted document gives the same failure, so the two cases look the same. - The parameters of a GCM cipher are the RFC 5084
GCMParametersSEQUENCE. The message is a DER decoding failure. - The salt of PBKDF2 or scrypt is longer than 32 bytes. The message is a DER decoding failure. The OpenSSL default salt is 16 bytes.
- The key is in the legacy OpenSSL traditional PEM format, with a
Proc-Type: 4,ENCRYPTEDheader line in the section. The message names theopenssl pkcs8 -topk8conversion, which gives a PKCS#8 key. This refusal applies with or without a passphrase.
Trait Implementations§
Source§impl Clone for ClientIdentity
impl Clone for ClientIdentity
Source§impl Debug for ClientIdentity
Redacts the private key and the passphrase.
impl Debug for ClientIdentity
Redacts the private key and the passphrase.
A logged configuration holds neither. The key shows as its length in
bytes, and the passphrase shows as "<redacted>" if it is set. The
certificate chain is public material and shows in full.
impl Eq for ClientIdentity
Source§impl PartialEq for ClientIdentity
impl PartialEq for ClientIdentity
impl StructuralPartialEq for ClientIdentity
Auto Trait Implementations§
impl Forget for ClientIdentity
impl Freeze for ClientIdentity
impl Move for ClientIdentity
impl RefUnwindSafe for ClientIdentity
impl Send for ClientIdentitywhere
RawVecInner: Send,
impl Sync for ClientIdentitywhere
RawVecInner: Sync,
impl Unpin for ClientIdentity
impl UnsafeUnpin for ClientIdentity
impl UnwindSafe for ClientIdentitywhere
RawVecInner: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.