From: Hiroshi NAKAMURA Date: 2011-05-13T13:32:05+09:00 Subject: [ruby-core:36167] [Ruby 1.9 - Bug #4421] [ext/openssl] Fix RSA public key encoding Issue #4421 has been updated by Hiroshi NAKAMURA. Martin: Congrats! Go ahead. Some comments; * Please add a test for each commit to express the intent of the change. It must help us in the future. * Please add some description about PKey format change to NEWS file. I think this change is OK (our older ruby should be able to read new format) but DSA might have some incompat behavior. DSA#p could be nil? Test it! Regards, // NaHi ---------------------------------------- Bug #4421: [ext/openssl] Fix RSA public key encoding http://redmine.ruby-lang.org/issues/4421 Author: Martin Bosslet Status: Closed Priority: Normal Assignee: Martin Bosslet Category: ext Target version: 1.9.3 ruby -v: - =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 -- http://redmine.ruby-lang.org