Add #signature_algorithm and update #ssh_do_sign and #to_blob

Modifies `OpenSSL::PKey::RSA` to provide a `#signature_algorithm`
    method which provides the signature algorithm value expected by
    OpenSSH. The `#ssh_do_sign` method is updated to use the set
    algorithm (SHA256) and `#to_blob` is updated to include the
    signature algorithm instead of the key type.
This commit is contained in:
Chris Roberts 2021-04-12 17:28:52 -07:00
parent 5bc3cdc987
commit 246058ffbb

View File

@ -99,6 +99,18 @@ if Net::SSH::Version::STRING == "6.1.0"
verify(digester, sig, data)
end
def signature_algorithm
"rsa-sha2-256"
end
def ssh_do_sign(data)
sign(OpenSSL::Digest::SHA256.new, data)
end
def to_blob
@blob ||= Net::SSH::Buffer.from(:string, signature_algorithm, :bignum, e, :bignum, n).to_s
end
end
OpenSSL::PKey::DSA.class_eval do