diff options
| author | mokha <mokha@cisco.com> | 2018-05-14 18:38:39 -0600 |
|---|---|---|
| committer | mokha <mokha@cisco.com> | 2018-05-14 18:38:39 -0600 |
| commit | d5299cb2c1149ff187b3b1da4d70a04253d82027 (patch) | |
| tree | 4d6cdd0d110f518e5f2d423f0bffc16905cb15a3 /lib | |
| parent | a417b0f2a34582618c93740fd74ca1c620a39e54 (diff) | |
test mutual tls connection.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/net/hippie/client.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/net/hippie/client.rb b/lib/net/hippie/client.rb index 53f80d7..feb5025 100644 --- a/lib/net/hippie/client.rb +++ b/lib/net/hippie/client.rb @@ -62,10 +62,7 @@ module Net http.use_ssl = uri.is_a?(URI::HTTPS) http.verify_mode = verify_mode http.set_debug_output(Net::Hippie.logger) - if certificate && key - http.cert = OpenSSL::X509::Certificate.new(certificate) if certificate - http.key = private_key - end + apply_client_tls_to(http) http end @@ -87,6 +84,13 @@ module Net OpenSSL::PKey::RSA.new(key) end end + + def apply_client_tls_to(http) + return if certificate.nil? || key.nil? + + http.cert = OpenSSL::X509::Certificate.new(certificate) if certificate + http.key = private_key + end end end end |
