https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112012-09-27T09:10:36ZRuby Issue Tracking SystemRuby master - Bug #7074: OpenSSL::PKey::RSA.new(public_key) fails if public_key doesn't have -----BEGIN PUBLIC KEY-----https://bugs.ruby-lang.org/issues/7074?journal_id=297562012-09-27T09:10:36ZMartinBosslet (Martin Bosslet)Martin.Bosslet@gmail.com
<ul><li><strong>Category</strong> set to <i>ext</i></li><li><strong>Status</strong> changed from <i>Open</i> to <i>Rejected</i></li><li><strong>Assignee</strong> set to <i>MartinBosslet (Martin Bosslet)</i></li></ul><p>public_key2 is not a valid PEM format (the one in public_key1). It's valid Base64, true, but that's not what OpenSSL expects. It can deal with either DER- or PEM-encoded data. In my eyes, there's nothing wrong here, or did you mean something else? Unless you object, I would close this as "Rejected" to indicate that the behavior is intended and not a bug.</p>
<p>PS: A clean way to deal with raw Base64 data such as in public_key2 would be to Base64-decode it first and then passing it on as in your example.</p>