class OpenSSL::PKey::RSA

with SSH functionality.
have been added to it by the Net::SSH module for convenience in dealing
This class is originally defined in the OpenSSL module. As needed, methods

def ssh_do_sign(data, sig_alg = nil)

Returns the signature for the given data.
def ssh_do_sign(data, sig_alg = nil)
  digester =
    if sig_alg == "rsa-sha2-512"
      OpenSSL::Digest::SHA512.new
    elsif sig_alg == "rsa-sha2-256"
      OpenSSL::Digest::SHA256.new
    else
      OpenSSL::Digest::SHA1.new
    end
  sign(digester, data)
end

def ssh_do_verify(sig, data, options = {})

Verifies the given signature matches the given data.
def ssh_do_verify(sig, data, options = {})
  digester =
    if options[:host_key] == "rsa-sha2-512"
      OpenSSL::Digest::SHA512.new
    elsif options[:host_key] == "rsa-sha2-256"
      OpenSSL::Digest::SHA256.new
    else
      OpenSSL::Digest::SHA1.new
    end
  verify(digester, sig, data)
end

def ssh_type

SSH2 protocol.
Returns "ssh-rsa", which is the description of this key type used by the
def ssh_type
  "ssh-rsa"
end

def to_blob

Converts the key to a blob, according to the SSH2 protocol.
def to_blob
  @blob ||= Net::SSH::Buffer.from(:string, ssh_type, :bignum, e, :bignum, n).to_s
end