[#35027] [Ruby 1.9-Bug#4352][Open] [patch] Fix eval(s, b) backtrace; make eval(s, b) consistent with eval(s) — "James M. Lawrence" <redmine@...>

Bug #4352: [patch] Fix eval(s, b) backtrace; make eval(s, b) consistent with eval(s)

16 messages 2011/02/01

[#35114] [Ruby 1.9-Bug#4373][Open] http.rb:677: [BUG] Segmentation fault — Christian Fazzini <redmine@...>

Bug #4373: http.rb:677: [BUG] Segmentation fault

59 messages 2011/02/06

[#35171] [Ruby 1.9-Bug#4386][Open] encoding: directive does not affect regex expressions — mathew murphy <redmine@...>

Bug #4386: encoding: directive does not affect regex expressions

9 messages 2011/02/09

[#35237] [Ruby 1.9-Bug#4400][Open] nested at_exit hooks run in strange order — Suraj Kurapati <redmine@...>

Bug #4400: nested at_exit hooks run in strange order

12 messages 2011/02/15

[ruby-core:35330] [Ruby 1.9-Feature#4424][Open] [ext/openssl] Allow public/private key creation from arbitrary data

From: Martin Bosslet <redmine@...>
Date: 2011-02-22 00:20:30 UTC
List: ruby-core #35330
Feature #4424: [ext/openssl] Allow public/private key creation from arbitrary data
http://redmine.ruby-lang.org/issues/show/4424

Author: Martin Bosslet
Status: Open, Priority: Normal
Category: ext, Target version: 1.9.3

There is a public funtion in PKey that allowed to read arbitrary
private keys from a file regardless of the actual key type, but it
was not exposed in Ruby, only in C. 
In Ruby, the only way to instantiate public/private keys is by 
calling initialize on the correct PKey subclass, implying that 
you need to know what kind of key you're actually dealing with. 
There are situations where the key type is not known in advance, 
e.g. if a certificate SubjectPublicKeyInfo shall be turned into 
a public key. In that case you only know that you're dealing with
a public key, but not necessarily with what kind of key. In 
situations like these it would come in handy to have methods that
create a PKey instance regardless of the underlying data.

The attached patch provides this by adding two module functions to 
PKey, read_public and read_private. They allow reading generic 
public/private keys from a String or a File, optionally providing
a password in the case of encrypted PEM encodings. RDoc has also
been supplemented.

Please note that the included tests partly rely on the patches 
proposed in

http://redmine.ruby-lang.org/issues/show/4421,
http://redmine.ruby-lang.org/issues/show/4422 and
http://redmine.ruby-lang.org/issues/show/4423

If those were applied, the combination with this patch would 
provide consistent behavior among all three public key systems
supported in Ruby.

Regards,
Martin


----------------------------------------
http://redmine.ruby-lang.org

Attachments (1)

pkey_from_data.tar.gz (1.89 KB, Archive)

In This Thread

Prev Next