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

Pelle

On 6/16/05, Bill Kelly <billk / cts.com> wrote:
> From: "Eric Hodel" <drbrain / segment7.net>
> >
> > On 15 Jun 2005, at 16:30, Bill Kelly wrote:
> >
> > 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).
> 
> 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
> 
> 
> 
> 


-- 
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