Forum: Ruby Certificates and Net::HTTP

C993c6aaffc6cf7b477a5075099e1d36?d=identicon&s=25 Peter Hickman (Guest)
on 2014-04-29 10:51
(Received via mailing list)
I am in the process of converting some Python code over to Ruby. The
runs in Python just fine and the Ruby code is almost working:

req = uri.path
req.body = "blah blah blah"

c = nil'config/certificates/client-2048.pem', 'rb') { |f| c =

res = Net::HTTP.start(, uri.port, :use_ssl => true) do |http|
  http.cert =
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
  http.ssl_version = :SSLv3
  http.request req

When this code is run is connects just fine res.code is '200' and the
service is returning JSON but it indicates that the certificate was not
being presented. In the Python code I have'https://...', data=payload,
'config/certificates/client-2048.key'), headers=headers)

I have the following file available client-2048.crt, client-2048.csr,
client-2048.key, client-2048.p12 and client-2048.pem and have tried
variation Google and StackOverflow shows me but without success.

Any pointers as to what I am doing wrong?
2ffac40f8a985a2b2749244b8a1c4161?d=identicon&s=25 Mike Stok (Guest)
on 2014-04-29 14:16
(Received via mailing list)
On Apr 29, 2014, at 4:50 AM, Peter Hickman
<> wrote:

>   http.cert =
> Any pointers as to what I am doing wrong?

Hello Peter,

Forgive me if this doesn't answer your question directly, but have you
considered ? seems to suggest a way to
set up the SSL context the way you want.

Hope this helps,



Mike Stok <>

The "`Stok' disclaimers" apply.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.