# SSLSocket - where does the encryption happen?

**URL:** <https://www.ruby-forum.com/t/sslsocket-where-does-the-encryption-happen/51514>\
**Category:** Ruby\
**Created:** [January 2, 2006, 3:19am UTC](https://www.ruby-forum.com/t/sslsocket-where-does-the-encryption-happen/51514 "2006-01-02T03:19:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kelleysislander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f6c823/32.png) [@kelleysislander](https://www.ruby-forum.com/u/kelleysislander)\
**Post date:** [January 2, 2006, 3:19am UTC](https://www.ruby-forum.com/t/sslsocket-where-does-the-encryption-happen/51514/1 "2006-01-02T03:19:07Z")

</div>

Howdy all, and Happy New Year.

I’m looking at OpenSSL::SSL::SSLSocket (openssl/ssl.rb), and  
also the code in drb/ssl.rb and webrick/ssl.rb … trying to  
understand where the actual encryption/decryption takes place.

All three of these are pretty similar - they set up an  
SSLContext, and they also wrap a plain ol’ TCPSocket. But I’m  
having trouble locating any code that would be performing the  
encryption/decryption on the actual I/O.

Is it right in front of my eyes and I’m not seeing it? If  
anyone could help shed some light on this I’d be grateful.

Thanks,

Regards,

Bill

---

<div class="post-metadata">

**Author:** ![kelleysislander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f6c823/32.png) [@kelleysislander](https://www.ruby-forum.com/u/kelleysislander)\
**Post date:** [January 2, 2006, 7:20am UTC](https://www.ruby-forum.com/t/sslsocket-where-does-the-encryption-happen/51514/2 "2006-01-02T07:20:01Z")

</div>

On 1/2/06, Bill K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Is it right in front of my eyes and I’m not seeing it? If  
> anyone could help shed some light on this I’d be grateful.

If I’m not terribly mistaken, all the actual work takes place in the C  
extension.  
[http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/ruby/ext/openssl/ossl\_ssl.c](http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/ruby/ext/openssl/ossl_ssl.c)  
 ← there’s the SSLSocket functions at least

---

<div class="post-metadata">

**Author:** ![kelleysislander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f6c823/32.png) [@kelleysislander](https://www.ruby-forum.com/u/kelleysislander)\
**Post date:** [January 2, 2006, 12:09pm UTC](https://www.ruby-forum.com/t/sslsocket-where-does-the-encryption-happen/51514/3 "2006-01-02T12:09:36Z")

</div>

Hi Ilmari,

From: “Ilmari H.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> On 1/2/06, Bill K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > I’m looking at OpenSSL::SSL::SSLSocket (openssl/ssl.rb), and  
> > also the code in drb/ssl.rb and webrick/ssl.rb … trying to  
> > understand where the actual encryption/decryption takes place.
> 
> If I’m not terribly mistaken, all the actual work takes place in the C  
> extension.  
> [http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/ruby/ext/openssl/ossl\_ssl.c](http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/ruby/ext/openssl/ossl_ssl.c)  
> ← there’s the SSLSocket functions at least

Thanks much! I should have realized… After all, the ruby-side  
SSLSocket  
class has no initialize()

```
class SSLSocket
  include Buffering
  include SocketForwarder
end

```

Thanks,

Bill
