Created
June 28, 2013 14:35
-
-
Save claudijd/5885143 to your computer and use it in GitHub Desktop.
Ruby OpenSSL verify peer enabled, empty cert store IRB example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> require 'socket' | |
=> true | |
>> require 'openssl' | |
=> true | |
>> | |
?> ssl_context = OpenSSL::SSL::SSLContext.new | |
=> #<OpenSSL::SSL::SSLContext:0x007fc4a09e3740> | |
>> ssl_context.verify_mode = OpenSSL::SSL::VERIFY_PEER | |
=> 1 | |
>> tcp_client = TCPSocket.new 'server.trustwave.com', 443 | |
=> #<TCPSocket:fd 5> | |
>> ssl_client = OpenSSL::SSL::SSLSocket.new tcp_client, ssl_context | |
=> #<OpenSSL::SSL::SSLSocket:0x007fc4a09fb688> | |
>> ssl_client.connect | |
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed | |
from (irb):8:in `connect' | |
from (irb):8 | |
from /Users/jclaudius/.rvm/rubies/ruby-1.9.3-p392/bin/irb:16:in `<main>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment