'OpenSSL for Ruby 2' project Copyright (C) 2001 GOTOU YUUZOU <gotoyuzo@notwork.org> All rights reserved.
This program is licenced under the same licence as Ruby. (See the file 'LICENCE'.)
$Id: telnets.rb 16878 2008-06-07 16:16:46Z shyouhei $ 2001/11/06: Contiributed to Ruby/OpenSSL project.
This class will initiate SSL/TLS session automaticaly if the server sent OPT_STARTTLS. Some options are added for SSL/TLS.
host = Net::Telnet::new({ "Host" => "localhost", "Port" => "telnets", ## follows are new options. 'CertFile' => "user.crt", 'KeyFile' => "user.key", 'CAFile' => "/some/where/certs/casert.pem", 'CAPath' => "/some/where/caserts", 'VerifyMode' => SSL::VERIFY_PEER, 'VerifyCallback' => verify_proc })
Or, the new options ('Cert', 'Key' and 'CACert') are available from Michal Rokos's OpenSSL module.
cert_data = File.open("user.crt"){|io| io.read } pkey_data = File.open("user.key"){|io| io.read } cacert_data = File.open("your_ca.pem"){|io| io.read } host = Net::Telnet::new({ "Host" => "localhost", "Port" => "telnets", 'Cert' => OpenSSL::X509::Certificate.new(cert_data) 'Key' => OpenSSL::PKey::RSA.new(pkey_data) 'CACert' => OpenSSL::X509::Certificate.new(cacert_data) 'CAFile' => "/some/where/certs/casert.pem", 'CAPath' => "/some/where/caserts", 'VerifyMode' => SSL::VERIFY_PEER, 'VerifyCallback' => verify_proc })
This class is expected to be a superset of usual Net::Telnet.