class Net::SSH::Buffer

def read_keyblob(type)

a key. Only RSA, DSA, and ECDSA keys are supported.
Read a keyblob of the given type from the buffer, and return it as
def read_keyblob(type)
  case type
  when /^(.*)-cert-v01@openssh\.com$/
    key = Net::SSH::Authentication::Certificate.read_certblob(self, $1)
  when /^ssh-dss$/
    p = read_bignum
    q = read_bignum
    g = read_bignum
    pub_key = read_bignum
    asn1 = OpenSSL::ASN1::Sequence.new(
      [
        OpenSSL::ASN1::Sequence.new(
          [
            OpenSSL::ASN1::ObjectId.new('DSA'),
            OpenSSL::ASN1::Sequence.new(
              [
                OpenSSL::ASN1::Integer.new(p),
                OpenSSL::ASN1::Integer.new(q),
                OpenSSL::ASN1::Integer.new(g)
              ]
            )
          ]
        ),
        OpenSSL::ASN1::BitString.new(OpenSSL::ASN1::Integer.new(pub_key).to_der)
      ]
    )
    key = OpenSSL::PKey::DSA.new(asn1.to_der)
  when /^ssh-rsa$/
    e = read_bignum
    n = read_bignum
    asn1 = OpenSSL::ASN1::Sequence(
      [
        OpenSSL::ASN1::Integer(n),
        OpenSSL::ASN1::Integer(e)
      ]
    )
    key = OpenSSL::PKey::RSA.new(asn1.to_der)
  when /^ssh-ed25519$/
    Net::SSH::Authentication::ED25519Loader.raiseUnlessLoaded("unsupported key type `#{type}'")
    key = Net::SSH::Authentication::ED25519::PubKey.read_keyblob(self)
  when /^ecdsa\-sha2\-(\w*)$/
    key = OpenSSL::PKey::EC.read_keyblob($1, self)
  else
    raise NotImplementedError, "unsupported key type `#{type}'"
  end
  return key
end