diff options
author | Vincent Ambo <mail@tazj.in> | 2019-02-26T16·16+0100 |
---|---|---|
committer | Vincent Ambo <mail@tazj.in> | 2019-02-26T16·30+0100 |
commit | 2349dd22c3a899a1a628966df700d5d8cdfd64ea (patch) | |
tree | ed85e56ec83d543aeee335f0f19cffc0d9b6088a /src/lib.rs | |
parent | 37dc54f2bfef14a96aacb8bbedc6c75432b7a825 (diff) |
feat: Split `tls_key_password` into a separate function
WHen configuring a PKCS12 certificate it is more useful to be able to set this separately, as the `tls_client_key` function is never called.
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/lib.rs b/src/lib.rs index d6d11604a067..1ebb3c4faff2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -177,21 +177,24 @@ impl <'a> Request<'a> { Ok(self) } - /// Configure a TLS client certificate key on the request with an - /// optional key passphrase. + /// Configure a TLS client certificate key on the request. /// /// Note that this does **not** need to be called again for /// PKCS12-encoded key pairs which are set via `tls_client_cert`. /// /// Currently only PEM-encoded key files are supported. - pub fn tls_client_key<P, S>(mut self, key: P, passphrase: Option<S>) - -> Result<Self, curl::Error> - where P: AsRef<Path>, S: AsRef<str> { + pub fn tls_client_key<P: AsRef<Path>>(mut self, key: P) -> Result<Self, curl::Error> { self.handle.ssl_key(key)?; - if let Some(pass) = passphrase { - self.handle.key_password(pass.as_ref())?; - } + Ok(self) + } + /// Configure an encryption password for a TLS client certificate + /// key on the request. + /// + /// This is required in case of an encrypted private key that + /// should be used. + pub fn tls_key_password(mut self, password: &str) -> Result<Self, curl::Error> { + self.handle.key_password(password)?; Ok(self) } |