Openssl problems

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

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. :frowning:


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

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?

libopenssl-ruby

wuyaSea operator
www.wuyaSea.com

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.

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