Class: OpenSSL::PKey::RSA
- Inherits:
-
Object
- Object
- OpenSSL::PKey::RSA
- Defined in:
- lib/net/ssh/transport/openssl.rb
Overview
This class is originally defined in the OpenSSL module. As needed, methods have been added to it by the Net::SSH module for convenience in dealing with SSH functionality.
Instance Method Summary collapse
-
#ssh_do_sign(data, sig_alg = nil) ⇒ Object
Returns the signature for the given data.
-
#ssh_do_verify(sig, data, options = {}) ⇒ Object
Verifies the given signature matches the given data.
-
#ssh_type ⇒ Object
(also: #ssh_signature_type)
Returns “ssh-rsa”, which is the description of this key type used by the SSH2 protocol.
-
#to_blob ⇒ Object
Converts the key to a blob, according to the SSH2 protocol.
Instance Method Details
#ssh_do_sign(data, sig_alg = nil) ⇒ Object
Returns the signature for the given data.
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/net/ssh/transport/openssl.rb', line 77 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 |
#ssh_do_verify(sig, data, options = {}) ⇒ Object
Verifies the given signature matches the given data.
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/net/ssh/transport/openssl.rb', line 63 def ssh_do_verify(sig, data, = {}) digester = if [:host_key] == "rsa-sha2-512" OpenSSL::Digest::SHA512.new elsif [:host_key] == "rsa-sha2-256" OpenSSL::Digest::SHA256.new else OpenSSL::Digest::SHA1.new end verify(digester, sig, data) end |
#ssh_type ⇒ Object Also known as: ssh_signature_type
Returns “ssh-rsa”, which is the description of this key type used by the SSH2 protocol.
51 52 53 |
# File 'lib/net/ssh/transport/openssl.rb', line 51 def ssh_type "ssh-rsa" end |