Project

General

Profile

Actions

Bug #4421

closed

[ext/openssl] Fix RSA public key encoding

Added by MartinBosslet (Martin Bosslet) almost 14 years ago. Updated almost 11 years ago.

Status:
Closed
Target version:
ruby -v:
-
Backport:
[ruby-core:35327]

Description

=begin
When calling RSA#to_der and RSA#to_pem on RSA public keys, they currently
get encoded using i2d_RSAPublicKey and PEM_write_bio_RSAPublicKey. This encoding
was specified in PKCS#1 and is specific to RSA. It is also not the default
encoding used by OpenSSL itself, which rather uses the generic format generated
by i2d_RSA_PUBKEY and PEM_write_bio_RSA_PUBKEY. This format is the same that is
used in a certificate's SubjectPublicKeyInfo, the advantage being that the format
is generic and can be used to represent public keys of all kinds, including RSA,
DSA and Elliptic Curve.

The attached patch will make use of the generic format for encoding RSA keys. The
change should not cause compatibility problems, since RSA#initialize uses several
fallback scenarios that cover public keys of both formats.

The fallbacks are also re-prioritized according to these changes.

Regards,
Martin
=end


Files

fix_rsa_pub_encoding.diff (1.65 KB) fix_rsa_pub_encoding.diff MartinBosslet (Martin Bosslet), 02/22/2011 08:18 AM
noname (500 Bytes) noname tenderlovemaking (Aaron Patterson), 05/10/2011 09:29 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0