title: Public/Private key authentication for Ruby Net::SFTP
body: <p>I am having trouble finding documentation for specifying a key for SFTP authentication.</p>
  
  <p>Would like to have something like:</p>
  
  <pre><code>export SOME_PRIVATE_KEY="$(cat tmp/some-certs/privatekey.pem)"
  
  # then somewhere in the code
  private_key = OpenSSL::PKey::RSA.new(ENV['SOME_PRIVATE_KEY'])
  
  Net::SFTP.start(ftp_host, user, key: private_key) do |sftp|
    sftp.dir.entries('/path/to/folder').each do |remote_file|
       # ...
    end
  end
  </code></pre>