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:Key::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
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:Key::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