Method: Net::SSH::KeyFactory.load_private_key
- Defined in:
- lib/net/ssh/key_factory.rb
.load_private_key(filename, passphrase = nil, ask_passphrase = true, prompt = Prompt.default) ⇒ Object
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.
42 43 44 45 |
# File 'lib/net/ssh/key_factory.rb', line 42 def load_private_key(filename, passphrase=nil, ask_passphrase=true, prompt=Prompt.default) data = File.read(File.(filename)) load_data_private_key(data, passphrase, ask_passphrase, filename, prompt) end |