Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing a self-signed certificate
    primarykey
    data
    text
    <p>I am just trying to get my head around SSL.</p> <p>I have set up a Jetty server on my localhost, and generated my own certificate using <a href="http://java.sun.com/j2se/1.3/docs/tooldocs/win32/keytool.html" rel="noreferrer">Keytool</a>.</p> <p>Now when I go to <a href="https://localhost:8443/" rel="noreferrer">https://localhost:8443/</a> I get the can't trust this certificate error.</p> <p>I use </p> <blockquote> <p>keytool -export -alias pongus -keystore keystore -file certfile.cer</p> </blockquote> <p>To create the certificate which I think is what the client needs to authenticate with the server. (This is where I could be very wrong!)</p> <p>I have the following ruby code :</p> <pre><code>require 'net/https' require 'openssl' require 'open-uri' puts 'yay' if File.exists?('certfile.cer') uri = URI.parse("https://localhost:8443/") http_session = Net::HTTP.new(uri.host, uri.port) http_session.use_ssl = true http_session.verify_mode = OpenSSL::SSL::VERIFY_PEER http_session.ca_file = 'certfile.cer' res = http_session.start do |http| # do some requests here http.get('/') end </code></pre> <p>This does print 'yay', so the certfile.cer file does exist.</p> <p>But I get the errors </p> <pre><code>/Applications/NetBeans/NetBeans 6.8.app/Contents/Resources/NetBeans/ruby2/jruby-1.4.0/lib/ruby/1.8/net/http.rb:586 warning: can't set verify locations /Applications/NetBeans/NetBeans 6.8.app/Contents/Resources/NetBeans/ruby2/jruby-1.4.0/lib/ruby/1.8/net/http.rb:586:in `connect': certificate verify failed (OpenSSL::SSL::SSLError) </code></pre> <p>Any ideas what I am doing wrong?</p> <p><strong>EDIT</strong></p> <p>I want to get it so I guarantee that I am connecting to the right server, and the server can guarantee that it is me connecting to it, without any tampering in between. I am developing both the server and the client.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload