load_data_private_key (Net::SSH::KeyFactory)

        # File lib/net/ssh/key_factory.rb, line 47
    47:       def load_data_private_key(data, passphrase=nil, filename="")
    48:         if data.match(/-----BEGIN DSA PRIVATE KEY-----/)
    49:           key_type = OpenSSL::PKey::DSA
    50:         elsif data.match(/-----BEGIN RSA PRIVATE KEY-----/)
    51:           key_type = OpenSSL::PKey::RSA
    52:         elsif data.match(/-----BEGIN (.*) PRIVATE KEY-----/)
    53:           raise OpenSSL::PKey::PKeyError, "not a supported key type '#{$1}'"
    54:         else
    55:           raise OpenSSL::PKey::PKeyError, "not a private key (#{filename})"
    56:         end
    57:
    58:         encrypted_key = data.match(/ENCRYPTED/)
    59:         tries = 0
    60:
    61:         begin
    62:           return key_type.new(data, passphrase || 'invalid')
    63:         rescue OpenSSL::PKey::RSAError, OpenSSL::PKey::DSAError => e
    64:           if encrypted_key
    65:             tries += 1
    66:             if tries <= 3
    67:               passphrase = prompt("Enter passphrase for #{filename}:", false)
    68:               retry
    69:             else
    70:               raise
    71:             end
    72:           else
    73:             raise
    74:           end
    75:         end
    76:       end