Project

General

Profile

Actions

Bug #7074

closed

OpenSSL::PKey::RSA.new(public_key) fails if public_key doesn't have -----BEGIN PUBLIC KEY-----

Added by dlee (David Lee) about 12 years ago. Updated about 12 years ago.

Status:
Rejected
Target version:
ruby -v:
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.0.0]
Backport:
[ruby-core:47705]

Description

=begin

public_key1 = <<KEY
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCfW7fNVCLBii/Ky/H97w9BAL6H
ifRM9sJkxo1dqCzvYHLk/89OmYMoDJ2+OgHRaoRpP+CSHiTkxQR1G+UbHLiQpZMo
CbcHAN6nDVET5ulgA8xywOAuIEgsJ5CmhWG79rZGqDNg6N2V5jgZ8WgLRuTn6aGb
+HqF23BDbpOUX8pGcQIDAQAB
-----END PUBLIC KEY-----
KEY

public_key2 = <<KEY
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCfW7fNVCLBii/Ky/H97w9BAL6H
ifRM9sJkxo1dqCzvYHLk/89OmYMoDJ2+OgHRaoRpP+CSHiTkxQR1G+UbHLiQpZMo
CbcHAN6nDVET5ulgA8xywOAuIEgsJ5CmhWG79rZGqDNg6N2V5jgZ8WgLRuTn6aGb
+HqF23BDbpOUX8pGcQIDAQAB
KEY

OpenSSL::PKey::RSA.new public_key1 #=> works
OpenSSL::PKey::RSA.new public_key2 #=> fails with error:

OpenSSL::PKey::RSAError: Neither PUB key nor PRIV key:: nested asn1 error

=end

Actions

Also available in: Atom PDF

Like0
Like0