From cb86672c36fe3b080689dd014f70f22e60aaeb13 Mon Sep 17 00:00:00 2001 From: Leigh Kennedy Date: Wed, 8 Feb 2017 17:38:00 +1100 Subject: [PATCH] added SSL client certificate support --- lib/websocket-client-simple/client.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/websocket-client-simple/client.rb b/lib/websocket-client-simple/client.rb index 128f523..f454fd8 100644 --- a/lib/websocket-client-simple/client.rb +++ b/lib/websocket-client-simple/client.rb @@ -26,6 +26,8 @@ def connect(url, options={}) cert_store = OpenSSL::X509::Store.new cert_store.set_default_paths ctx.cert_store = cert_store + ctx.cert = OpenSSL::X509::Certificate.new(File.read(options[:cert_chain_file])) || nil + ctx.key = OpenSSL::PKey::RSA.new(File.read(options[:private_key_file])) || nil @socket = ::OpenSSL::SSL::SSLSocket.new(@socket, ctx) @socket.connect end