From: Baduk Baduk on 1 May 2010 05:44 Is it possible to 'upgrade' a normal socket to an SSL socket. I would like to transmit and receive some data in plain text initially, before performing the SSL handshake and start communicating securely, without having to close and create a new socket. Does anyone have an example of this, preferably the more complete the better =) Thanks -- Posted via http://www.ruby-forum.com/.
From: Roger Pack on 1 May 2010 19:50 > Is it possible to 'upgrade' a normal socket to an SSL socket. I would > like to transmit and receive some data in plain text initially, before > performing the SSL handshake and start communicating securely, without > having to close and create a new socket. I think you can do it with eventmachine, since you call start_tls whenever you want. not sure about normal sockets, maybe there's a constructor to SSLSocket that takes a descriptor so you can pass descriptors about? -rp -- Posted via http://www.ruby-forum.com/.
From: Brian Candler on 2 May 2010 04:43 Baduk Baduk wrote: > Is it possible to 'upgrade' a normal socket to an SSL socket. I would > like to transmit and receive some data in plain text initially, before > performing the SSL handshake and start communicating securely, without > having to close and create a new socket. > > Does anyone have an example of this, preferably the more complete the > better =) There's a complete working example of this in ruby-ldapserver, see lib/ldap/server/connection.rb. The core is: def startssl # :yields: @mutex.synchronize do raise LDAP::ResultError::OperationsError if @ssl or @active_reqs.size > 0 yield if block_given? @io = OpenSSL::SSL::SSLSocket.new(@io, @opt[:ssl_ctx]) @io.sync_close = true @io.accept @ssl = true end end -- Posted via http://www.ruby-forum.com/.
|
Pages: 1 Prev: Online survey jobs & data entry jobs Next: a ruby 1.8.5 list of ruby VM's |