net-ssh/net-ssh — pull request #58 by nagachika (2012-09-04 17:08:25+00:00)
Title: Use OpenSSL::PKey.read to read arbitrary private key.

When I try to use RSA private key generated by the command bellow,
$ openssl req -new -nodes -newkey rsa:2048 -keyout my.key -out my.pem
(newly generated RSA Private key is stored in 'my.key')
Net::SSH::KeyFactory.load_private_key raise OpenSSL::PKey::PKeyError with a message "not a private key".
That's because my.key begins with a line like "---- BEGIN PRIVATE KEY ----".

OpenSSL::PKey.read was introduced from 1.9.3 to read arbitrary public/private key from DER-/PEM-encoded file. OpenSSL::PKey.read helps to load private keys generated by `openssl req -newkey` command.

Best regards,