# Openssl problems

**URL:** <https://www.ruby-forum.com/t/openssl-problems/78017>\
**Category:** Rails\
**Created:** [December 2, 2006, 8:28pm UTC](https://www.ruby-forum.com/t/openssl-problems/78017 "2006-12-02T20:28:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![chadster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/46a35a/32.png) [@chadster](https://www.ruby-forum.com/u/chadster)\
**Post date:** [December 2, 2006, 8:28pm UTC](https://www.ruby-forum.com/t/openssl-problems/78017/1 "2006-12-02T20:28:03Z")

</div>

Help!

I am one problem away from launching our new rails app. Sorry if this  
isn’t  
totally a rails question but my whole rails app is dependent on it and  
this  
group has been helpful.

Does anyone know why I continually get the following error?

* * *

irb(main):001:0\> require ‘openssl’

LoadError: no such file to load – openssl

```
    from (irb):1:in `require'

    from (irb):1

```

* * *

I’ve read every post on the internet about this. I’ve blown away my  
ruby  
install like 6 times. But I think apt-get is putting my libraries  
somewhere  
that ruby isn’t seeing them…? How can I check?

I’ve installed:

Ubuntu 6.10

ruby 1.8.5

openssl

libssl-dev

libopenssl-ruby

libzlib-ruby

libyaml-ruby

libdrb-ruby

liberb-ruby

zlib1g-dev

Any suggestions?

Thank you,

Chad

---

<div class="post-metadata">

**Author:** ![chadster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/46a35a/32.png) [@chadster](https://www.ruby-forum.com/u/chadster)\
**Post date:** [December 2, 2006, 11:50pm UTC](https://www.ruby-forum.com/t/openssl-problems/78017/2 "2006-12-02T23:50:39Z")

</div>

when I “require openssl” in irb, i get false, but not “file not found”.

check if your /1.8/openssl folder exists.

try run following code from command line. if you still get error, then  
u got some serious problem. ☹

* * *

require ‘openssl’

class Cipher  
@@cipher\_key = nil  
@@cipher\_iv = nil

```
def self.encrypt(data_to_encrypt)
  cipher = OpenSSL::Cipher::Cipher.new( "aes-128-cbc" )
  cipher.encrypt
  cipher.key = @@cipher_key = cipher.random_key
  cipher.iv = @@cipher_iv = cipher.random_iv

  output = cipher.update( data_to_encrypt )
  output << cipher.final
end

def self.decrypt(data)
  cipher = OpenSSL::Cipher::Cipher.new( "aes-128-cbc" )
  cipher.decrypt
  cipher.key = @@cipher_key
  cipher.iv = @@cipher_iv

  output = cipher.update( data )
  output << cipher.final
end

```

end

## msg = Cipher.encrypt(“1234567890”) puts msg puts Cipher.decrypt(msg)

wuyaSea O. [www.wuyaSea.com](http://www.wuyaSea.com)

---

<div class="post-metadata">

**Author:** ![chadster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/46a35a/32.png) [@chadster](https://www.ruby-forum.com/u/chadster)\
**Post date:** [December 3, 2006, 12:02am UTC](https://www.ruby-forum.com/t/openssl-problems/78017/3 "2006-12-03T00:02:42Z")

</div>

That’s the thing… My directory:

/usr/local/lib/ruby/1.8/ does NOT have an openssl directory… I keep  
installing it, but it doesn’t put it there. I just get these:

[/] # find / -name openssl  
/usr/bin/openssl  
/usr/include/openssl  
/usr/local/ssl/bin/openssl  
/usr/local/ssl/include/openssl

Should I try copying some files over directly to the ruby/1.8  
directory?

---

<div class="post-metadata">

**Author:** ![chadster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/46a35a/32.png) [@chadster](https://www.ruby-forum.com/u/chadster)\
**Post date:** [December 3, 2006, 12:27am UTC](https://www.ruby-forum.com/t/openssl-problems/78017/4 "2006-12-03T00:27:23Z")

</div>

libopenssl-ruby

wuyaSea operator  
[www.wuyaSea.com](http://www.wuyaSea.com)

---

<div class="post-metadata">

**Author:** ![chadster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/46a35a/32.png) [@chadster](https://www.ruby-forum.com/u/chadster)\
**Post date:** [December 3, 2006, 12:33am UTC](https://www.ruby-forum.com/t/openssl-problems/78017/5 "2006-12-03T00:33:25Z")

</div>

Ya that was installed, but thanks…

After 2 days, i got it to work… I cleaned out all the current  
openssl files, then took the ruby 1.8.5 source, went into the  
ruby-1.8.5/ext/openssl directory and created the openssl make file:

ruby extconf.rb  
make  
make install

and that fiiiiinally but the libraries where they should go.

---

<div class="post-metadata">

**Author:** ![chadster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/46a35a/32.png) [@chadster](https://www.ruby-forum.com/u/chadster)\
**Post date:** [December 3, 2006, 12:45am UTC](https://www.ruby-forum.com/t/openssl-problems/78017/6 "2006-12-03T00:45:28Z")

</div>

that sucked. i’m on gentoo, openssl for ruby is installed by default.

you don’t have to move openssl out of ext/, if you have “ruby/ext/” in  
the loading path. i don’t much about how ruby class loading work.

wuyaSea operator  
[www.wuyaSea.com](http://www.wuyaSea.com)
