unknown_ca exception when using client certificate in net::https

  • Thread starter William (the Better one)
  • Start date
W

William (the Better one)

Hello All,

I have using net::https in an Jruby program to connect an SSL web site
required an client certificate. I got the required client certificate
and tested it in IE and Firefox. In both IE and Firefox, it works
fine. Then I tried to use it in my Jruby program by using net::https
library. Below is my code:

uri = URI.parse( "https://test.com/test2/request" )
ds_http = Net::HTTP.new uri.host, uri.port
ds_http.use_ssl = true

File.open( "client_cer.pem", 'rb' ) do |f|
keydata = f.read
ds_http.cert = OpenSSL::X509::Certificate.new(keydata)
ds_http.key = OpenSSL::pKey::RSA.new(keydata, nil)
ds_http.ca_file = CA_PATH
end

res = ds_http.start {|http| http.request(req, rqt) }

When I run it by using Jruby, I got below exception:

C:/atb/jruby-1.3.1/bin/../lib/ruby/1.8/net/protocol.rb:135:in
`rbuf_fill': Recei
ved fatal alert: unknown_ca (IOError)
from C:/atb/jruby-1.3.1/bin/../lib/ruby/1.8/net/protocol.rb:
134:in `rbuf
_fill'

If anybody have any idea would be great appreciated.

Thanks in advance,
Jim
 
R

Roger Pack

C:/atb/jruby-1.3.1/bin/../lib/ruby/1.8/net/protocol.rb:135:in
`rbuf_fill': Recei
ved fatal alert: unknown_ca (IOError)
from C:/atb/jruby-1.3.1/bin/../lib/ruby/1.8/net/protocol.rb:
134:in `rbuf
_fill'

Does it work in MRI? Also note that the active_merchant code uses CA's
if their code is any help demo-wise.
-r
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,149
Members
46,695
Latest member
StanleyDri

Latest Threads

Top