Class | Net::SSH::KeyFactory |
In: |
lib/net/ssh/key_factory.rb
|
Parent: | Object |
A factory class for returning new Key classes. It is used for obtaining OpenSSL key instances via their SSH names, and for loading both public and private keys. It used used primarily by Net::SSH itself, internally, and will rarely (if ever) be directly used by consumers of the library.
klass = Net::SSH::KeyFactory.get("rsa") assert klass.is_a?(OpenSSL::PKey::RSA) key = Net::SSH::KeyFacory.load_public_key("~/.ssh/id_dsa.pub")
Loads a private key. It will correctly determine whether the file describes an RSA or DSA key, and will load it appropriately. The new key is returned. If the key itself is encrypted (requiring a passphrase to use), the user will be prompted to enter their password unless passphrase works.
Loads a public key. It will correctly determine whether the file describes an RSA or DSA key, and will load it appropriately. The new public key is returned.
Loads a private key from a file. It will correctly determine whether the file describes an RSA or DSA key, and will load it appropriately. The new key is returned. If the key itself is encrypted (requiring a passphrase to use), the user will be prompted to enter their password unless passphrase works.