From d5299cb2c1149ff187b3b1da4d70a04253d82027 Mon Sep 17 00:00:00 2001 From: mokha Date: Mon, 14 May 2018 18:38:39 -0600 Subject: test mutual tls connection. --- lib/net/hippie/client.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3