mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/openssl: imported.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fd46a1da0a
commit
231247c010
63 changed files with 12561 additions and 0 deletions
57
ext/openssl/lib/net/protocols.rb
Normal file
57
ext/openssl/lib/net/protocols.rb
Normal file
|
@ -0,0 +1,57 @@
|
|||
=begin
|
||||
= $RCSfile$ -- SSL/TLS enhancement for Net.
|
||||
|
||||
= Info
|
||||
'OpenSSL for Ruby 2' project
|
||||
Copyright (C) 2001 GOTOU YUUZOU <gotoyuzo@notwork.org>
|
||||
All rights reserved.
|
||||
|
||||
= Licence
|
||||
This program is licenced under the same licence as Ruby.
|
||||
(See the file 'LICENCE'.)
|
||||
|
||||
= Requirements
|
||||
This program requires Net 1.2.0 or higher version.
|
||||
You can get it from RAA or Ruby's CVS repository.
|
||||
|
||||
= Version
|
||||
$Id$
|
||||
|
||||
2001/11/06: Contiributed to Ruby/OpenSSL project.
|
||||
=end
|
||||
|
||||
require 'net/protocol'
|
||||
require 'forwardable'
|
||||
require 'openssl'
|
||||
|
||||
module Net
|
||||
class SSLIO < InternetMessageIO
|
||||
extend Forwardable
|
||||
|
||||
def_delegators(:@ssl_context,
|
||||
:key=, :cert=, :key_file=, :cert_file=,
|
||||
:ca_file=, :ca_path=,
|
||||
:verify_mode=, :verify_callback=, :verify_depth=,
|
||||
:timeout=, :cert_store=)
|
||||
|
||||
def initialize(addr, port, otime = nil, rtime = nil, dout = nil)
|
||||
super
|
||||
@ssl_context = OpenSSL::SSL::SSLContext.new()
|
||||
end
|
||||
|
||||
def ssl_connect()
|
||||
@raw_socket = @socket
|
||||
@socket = OpenSSL::SSL::SSLSocket.new(@raw_socket, @ssl_context)
|
||||
@socket.connect
|
||||
end
|
||||
|
||||
def close
|
||||
super
|
||||
@raw_socket.close if @raw_socket
|
||||
end
|
||||
|
||||
def peer_cert
|
||||
@socket.peer_cert
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue