ruby openssl ?

B

Bill Kelly

Hi,

I've just begun a project where I'd like to do public
key encryption, and have been looking for docs and/or
examples using the ruby openssl library.

So far, I've found:
http://www.ruby-doc.org/stdlib/libdoc/openssl/rdoc/index.html
and:
http://www.nongnu.org/rubypki/README
which have been of limited help so far.

So I figured I'd download the source... The RAA page leads
me to: http://www.nongnu.org/rubypki/ , however the download
link there is broken.

The CVS browser seems to be working, but there are two
projects, "ossl", and "ossl2". I'm not sure which is
the most current / appropriate to checkout. Neither
seems to have any files recently modified, although the
README link above warns, "All code is under development -
API/method names can change."

If anyone can help with either a) finding the correct
source to download, and/or b) finding some documentation
and example code, I'd be grateful.. maybe even ebullient.. :)

Thanks!

Regards,

Bill
 
E

Eric Hodel

Hi,

I've just begun a project where I'd like to do public
key encryption, and have been looking for docs and/or
examples using the ruby openssl library.

There should be a sample/openssl directory in the ruby tarball.
So I figured I'd download the source... The RAA page leads
me to: http://www.nongnu.org/rubypki/ , however the download
link there is broken.

ruby 1.8 includes OpenSSL, so you just need the ruby tarball. The
source of openssl itself is probably not worth looking at (but sample/
openssl might be).
 
B

Bill Kelly

From: "Eric Hodel said:
On 15 Jun 2005, at 16:30, Bill Kelly wrote:

There should be a sample/openssl directory in the ruby tarball.


ruby 1.8 includes OpenSSL, so you just need the ruby tarball. The
source of openssl itself is probably not worth looking at (but sample/
openssl might be).

Thanks! .... Hmm..

Anyone know what I'm doing wrong here? I generated a
public/private key pair, then tried to sign some data
and verify the signature:

irb(main):001:0> require 'openssl'
=> true
irb(main):002:0> include OpenSSL
=> Object
irb(main):003:0> keypair = PKey::RSA.new(1024)
=> -----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
irb(main):004:0> sig = keypair.sign(Digest::MD5.new, "abcdefg")
=> "...binary-data..."
irb(main):005:0> keypair.verify(Digest::MD5.new, "abcdefg", sig)
=> false

...I was hoping the answer would be "true". But I'm
pretty much guessing as to how to call these methods...


Thanks!

Regards,

Bill
 
P

Pelle Braendgaard

Hi Bill,
In your verify statement you need to swap the sig and the data

Pelle

=20
Thanks! .... Hmm..
=20
Anyone know what I'm doing wrong here? I generated a
public/private key pair, then tried to sign some data
and verify the signature:
=20
irb(main):001:0> require 'openssl'
=3D> true
irb(main):002:0> include OpenSSL
=3D> Object
irb(main):003:0> keypair =3D PKey::RSA.new(1024)
=3D> -----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
irb(main):004:0> sig =3D keypair.sign(Digest::MD5.new, "abcdefg")
=3D> "...binary-data..."
irb(main):005:0> keypair.verify(Digest::MD5.new, "abcdefg", sig)
=3D> false
=20
...I was hoping the answer would be "true". But I'm
pretty much guessing as to how to call these methods...
=20
=20
Thanks!
=20
Regards,
=20
Bill
=20
=20
=20
=20


--=20
https://stakeitout.com + Stake out your own micro ventures
http://neubia.com + Geek blog
http://stakeventures.com + Bootstrapping blog
http://SoapBX.com + Get on the box and shout
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
474,260
Messages
2,571,039
Members
48,768
Latest member
first4landlord

Latest Threads

Top