Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > OpenSSL::PKey::RSA accepts empty constructor (BUG?)

Reply
Thread Tools

OpenSSL::PKey::RSA accepts empty constructor (BUG?)

 
 
leon breedt
Guest
Posts: n/a
 
      01-22-2005
It doesn't seem like you can do much with an empty RSA object (no #new
parameters), so I'm not sure why its exposed to Ruby? It does not seem
possible to set public/private key values after the fact on an RSA
instance.

Also, it allows for possible coredumps:

irb(main):001:0> require 'openssl'
=> true
irb(main):002:0> rsa = OpenSSL:Key::RSA.new
=> -----BEGIN RSA PUBLIC KEY-----
MAA=
-----END RSA PUBLIC KEY-----

irb(main):004:0> rsa.public_encrypt "data"
(irb):4: [BUG] Segmentation fault
ruby 1.8.2 (2004-12-23) [i386-linux]

Leon


 
Reply With Quote
 
 
 
 
Jamis Buck
Guest
Posts: n/a
 
      01-22-2005
On 14:10 Sat 22 Jan , leon breedt wrote:
> It doesn't seem like you can do much with an empty RSA object (no #new
> parameters), so I'm not sure why its exposed to Ruby? It does not seem
> possible to set public/private key values after the fact on an RSA
> instance.


Actually, Net::SSH needs this. It allows you to explicitly set the
key's parameters:

rsa = OpenSSL:Key::RSA.new
rsa.e = 1234123432
rsa.n = 3453234398

DSA and DH keys also allow the empty constructor.

>
> Also, it allows for possible coredumps:
>
> irb(main):001:0> require 'openssl'
> => true
> irb(main):002:0> rsa = OpenSSL:Key::RSA.new
> => -----BEGIN RSA PUBLIC KEY-----
> MAA=
> -----END RSA PUBLIC KEY-----
>
> irb(main):004:0> rsa.public_encrypt "data"
> (irb):4: [BUG] Segmentation fault
> ruby 1.8.2 (2004-12-23) [i386-linux]


And yah, that's a bug. The methods should check to see that the
key's parameters are non-null before trying to do anything with them.

- Jamis

--
Jamis Buck
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://jamis.jamisbuck.org
------------------------------
"I am Victor of Borge. You will be assimil-nine-ed."



 
Reply With Quote
 
 
 
 
leon breedt
Guest
Posts: n/a
 
      01-23-2005
On Sat, 22 Jan 2005 23:23:38 +0900, Jamis Buck <(E-Mail Removed)> wrote:
> Actually, Net::SSH needs this. It allows you to explicitly set the
> key's parameters:
>
> rsa = OpenSSL:Key::RSA.new
> rsa.e = 1234123432
> rsa.n = 3453234398
>
> DSA and DH keys also allow the empty constructor.

I noticed

From reading the archives, it appears you've done a fair amount of
work in terms of finding out what the OpenSSL bindings do.

I'm busy slowly adding RDoc to the OpenSSL bindings, mind if I ask you
to proofread when I have something more substantial to show?

I have very little in the way of experience with OpenSSL, but having
needed to use it recently in Ruby, I wasted a lot of time trying to
figure out what to do, so I'm hoping documenting the Ruby bindings
will alleviate this for the next person who comes along to do it.

Its currently not too clear how to add documentation for in-tree stuff
though, so I've just started adding stuff to ext/ossl/*.c, but I'm
wary that a massive patch adding the docs won't get accepted.

Any ideas?

Cheers
Leon


 
Reply With Quote
 
Jamis Buck
Guest
Posts: n/a
 
      01-23-2005
On 14:03 Sun 23 Jan , leon breedt wrote:
> On Sat, 22 Jan 2005 23:23:38 +0900, Jamis Buck <(E-Mail Removed)> wrote:
> > Actually, Net::SSH needs this. It allows you to explicitly set the
> > key's parameters:
> >
> > rsa = OpenSSL:Key::RSA.new
> > rsa.e = 1234123432
> > rsa.n = 3453234398
> >
> > DSA and DH keys also allow the empty constructor.

> I noticed
>
> >From reading the archives, it appears you've done a fair amount of

> work in terms of finding out what the OpenSSL bindings do.
>
> I'm busy slowly adding RDoc to the OpenSSL bindings, mind if I ask you
> to proofread when I have something more substantial to show?


Well, I figured out what I needed to make Net::SSH work, which is only
a fairly small subset of OpenSSL (mostly just the Bignum stuff, and
keys). I'd be happy to read over your docs, though. Just might not be
give much feedback on most of it.

>
> I have very little in the way of experience with OpenSSL, but having
> needed to use it recently in Ruby, I wasted a lot of time trying to
> figure out what to do, so I'm hoping documenting the Ruby bindings
> will alleviate this for the next person who comes along to do it.


Generations to come will bless your name, Leon!

> Its currently not too clear how to add documentation for in-tree stuff
> though, so I've just started adding stuff to ext/ossl/*.c, but I'm
> wary that a massive patch adding the docs won't get accepted.
>
> Any ideas?


Good question. I'm not very familiar with the process of documenting
the modules. James Britt--I assume you'd know more about this?

- Jamis

--
Jamis Buck
(E-Mail Removed)
http://jamis.jamisbuck.org
------------------------------
"I am Victor of Borge. You will be assimil-nine-ed."



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XSD that accepts empty value kieroneil XML 2 02-26-2008 01:53 PM
A constructor calling another constructor (default constructor)? Generic Usenet Account C++ 10 11-28-2007 04:12 AM
PIX515 v.6.2(2) accepts IPSec NAT? Sur Cisco 1 11-22-2005 10:41 AM
Checking Whether a Browser Accepts Cookies rsindall@zethics.com ASP .Net 1 10-08-2004 07:15 AM
Using viewstate Accepts data changes :< Egbert Nierop \(MVP for IIS\) ASP .Net 0 08-20-2003 03:53 PM



Advertisments