# Ssl certificates

**URL:** <https://www.ruby-forum.com/t/ssl-certificates/64638>\
**Category:** Rails\
**Created:** [February 8, 2006, 12:39pm UTC](https://www.ruby-forum.com/t/ssl-certificates/64638 "2006-02-08T12:39:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giedrius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/6a8cbe/32.png) [@Giedrius](https://www.ruby-forum.com/u/Giedrius)\
**Post date:** [February 8, 2006, 12:39pm UTC](https://www.ruby-forum.com/t/ssl-certificates/64638/1 "2006-02-08T12:39:16Z")

</div>

Hi,  
could someone help me with ssl certificates?

i have mycert.pfx file (client certificate) and CA certificate ca.cer.  
i far as i know, ruby doesn’t understand pfx format, so i’ve converted  
it to pem format.  
in viewer pem looks like:

Bag attributes  
blabla

Key Attributes  
blabla

—begin rsa private key—  
blabla  
—end rsa private key-----

–begin certificate--------  
blabla  
–end certificate----------

in some example a saw, that there should be three files, looks like pfx  
file should be splited to two separate files?

how to prepare those two files(mycert.pfx and ca.cer) for using with  
HttpClient in ruby? How to use them with HttpClient?

Giedrius

---

<div class="post-metadata">

**Author:** ![Giedrius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/6a8cbe/32.png) [@Giedrius](https://www.ruby-forum.com/u/Giedrius)\
**Post date:** [February 9, 2006, 12:44pm UTC](https://www.ruby-forum.com/t/ssl-certificates/64638/2 "2006-02-09T12:44:10Z")

</div>

I can’t understand, is my question stupid enough or there’s no people,  
who tryed to work with ruby over ssl?  
I’ve posting like fourth question regarding SSL on various aspects and  
didn’t received any response from anyone.

---

<div class="post-metadata">

**Author:** ![Giedrius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/6a8cbe/32.png) [@Giedrius](https://www.ruby-forum.com/u/Giedrius)\
**Post date:** [February 8, 2006, 2:37pm UTC](https://www.ruby-forum.com/t/ssl-certificates/64638/3 "2006-02-08T14:37:28Z")

</div>

I was making this:

converted ca.cer file  
openssl x509 -in ca.cer -inform DER -out ca.pem -outform PEM

converted mycert.pfx to mycert.pem and splited this to two files in  
my\_key.pem placed rsa key part and in my\_cert.pem placed certificate  
part.

wrote code:

require ‘http-access2’  
url = ARGV.shift || ‘[https://zzz.com](https://zzz.com)’  
uri = URI.parse(url)  
ca\_file = “ca.pem”  
cl\_cert = “my\_cert.pem”  
cl\_key = “my\_key.pem”  
proxy = ENV[‘HTTP\_PROXY’] || ENV[‘http\_proxy’] || nil  
h = HTTPClient.new(proxy)  
h.ssl\_config.set\_client\_cert\_file(cl\_cert, cl\_key)  
h.ssl\_config.set\_trust\_ca(ca\_file)  
print h.get\_content(url)

and received error:

at depth 0 - 20: unable to get local issuer certificate

what i did wrong or what i forgot to do?

---

<div class="post-metadata">

**Author:** ![Giedrius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/6a8cbe/32.png) [@Giedrius](https://www.ruby-forum.com/u/Giedrius)\
**Post date:** [February 9, 2006, 3:15pm UTC](https://www.ruby-forum.com/t/ssl-certificates/64638/4 "2006-02-09T15:15:50Z")

</div>

On Thursday 09 Feb 2006 11:44, Giedrius wrote:

> I can’t understand, is my question stupid enough or there’s no people,  
> who tryed to work with ruby over ssl?  
> I’ve posting like fourth question regarding SSL on various aspects and  
> didn’t received any response from anyone.

Hi Giedrius,

Don’t be disheartened, this list is very busy and hard to keep track of.  
I  
haven’t used it through the forum, but certainly on the mailing list, I  
only  
dip in now and then, because there’s no way I have time to read  
everything.  
I imagine it’s the same for a lot of others.

Anyway, I don’t know if this helps you, but I’m developing an SSL Rails  
app,  
and used the following tutorial to set it up with Lighttpd:

[http://wiki.archlinux.org/index.php/Lighttpd\_For\_Both\_SSL\_And\_Non-SSL](http://wiki.archlinux.org/index.php/Lighttpd_For_Both_SSL_And_Non-SSL)

I don’t bother running two Lighttpd daemons though (one for SSL and one  
for  
non-SSL) - seemed like too much trouble to get that to launch when I run  
script/server, so I simply didn’t worry about it - my entire app runs  
over  
SSL.

So, I don’t know if that really answers your question, but that’s how I  
did  
it, though it took me a while to figure it out before I found that  
tutorial.  
(Back then, the default script/server was WEBrick anyway, so initially I  
was  
trying to get that working with SSL and gave up completely.)

Is that any help? (Maybe not, I haven’t used HttpClient myself.)

Cheers,

~Dave

–

Dave S.  
Rent-A-Monkey Website Development

> **[Tree Removal Service For Home & Businesses in Salt Lake City, UT](https://www.rentamonkey.com/)**
>
> Rent A Monkey Tree Service provides the safest, highest-quality tree removal for Salt Lake City, UT homes and businesses. Request a service today!

PGP Key: [http://www.rentamonkey.com/pgpkey.asc](http://www.rentamonkey.com/pgpkey.asc)

---

<div class="post-metadata">

**Author:** ![Giedrius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/6a8cbe/32.png) [@Giedrius](https://www.ruby-forum.com/u/Giedrius)\
**Post date:** [August 21, 2007, 6:46pm UTC](https://www.ruby-forum.com/t/ssl-certificates/64638/5 "2007-08-21T18:46:12Z")

</div>

Giedrius wrote:

> I can’t understand, is my question stupid enough or there’s no people,  
> who tryed to work with ruby over ssl?  
> I’ve posting like fourth question regarding SSL on various aspects and  
> didn’t received any response from anyone.

It’s not a stupid question at all, in fact I stumble on the same  
problems.

Your previous “partial” answers helped me.

I created this reminder for me of how I finally did it… I hope this  
will help others 🙂

- Https, Ssl and Ruby  
[http://benjamin.francisoud.googlepages.com/howtodogetorpostrequestinhttpssslandruby](http://benjamin.francisoud.googlepages.com/howtodogetorpostrequestinhttpssslandruby)

- You can leave comment on my blog:  
[Ruby's Cube: How to use HTTPS/SSL in Ruby](http://rubyscube.blogspot.com/2007/08/how-to-use-httpsssl-in-ruby.html)
