Project

General

Profile

Feature #15353 ยป client.rb

Test client - mkauf (Michael Kaufmann), 11/28/2018 03:43 PM

 
1
require 'socket'
2
require 'openssl'
3

    
4
ctx = OpenSSL::SSL::SSLContext.new
5
ctx.cert = OpenSSL::X509::Certificate.new(File.read "MyClient1.pem")
6
ctx.key = OpenSSL::PKey::RSA.new(File.read "MyClient1.key")
7
sock = TCPSocket.new('localhost', 1234)
8
ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
9
ssl.connect
10

    
11
puts ssl.ssl_version
12

    
13

    
14
while true do
15
    s = ssl.gets
16
    break if s.nil?
17
    puts s
18
end