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.
Public instance methods
ssh_do_sign
(data)
Signs the given data.
[show source]
# File lib/net/ssh/transport/openssl.rb, line 107 107: def ssh_do_sign(data) 108: sig = sign( OpenSSL::Digest::DSS1.new, data) 109: a1sig = OpenSSL::ASN1.decode( sig ) 110: 111: sig_r = a1sig.value[0].value.to_s(2) 112: sig_s = a1sig.value[1].value.to_s(2) 113: 114: if sig_r.length > 20 || sig_s.length > 20 115: raise OpenSSL::PKey::DSAError, "bad sig size" 116: end 117: 118: sig_r = "\0" * ( 20 - sig_r.length ) + sig_r if sig_r.length < 20 119: sig_s = "\0" * ( 20 - sig_s.length ) + sig_s if sig_s.length < 20 120: 121: return sig_r + sig_s 122: end
ssh_do_verify
(sig, data)
Verifies the given signature matches the given data.
[show source]
# File lib/net/ssh/transport/openssl.rb, line 96 96: def ssh_do_verify(sig, data) 97: sig_r = sig[0,20].unpack("H*")[0].to_i(16) 98: sig_s = sig[20,20].unpack("H*")[0].to_i(16) 99: a1sig = OpenSSL::ASN1::Sequence([ 100: OpenSSL::ASN1::Integer(sig_r), 101: OpenSSL::ASN1::Integer(sig_s) 102: ]) 103: return verify(OpenSSL::Digest::DSS1.new, a1sig.to_der, data) 104: end
ssh_type
()
Returns “ssh-dss”, which is the description of this key type used by the SSH2 protocol.
[show source]
# File lib/net/ssh/transport/openssl.rb, line 85 85: def ssh_type 86: "ssh-dss" 87: end
to_blob
()
Converts the key to a blob, according to the SSH2 protocol.
[show source]
# File lib/net/ssh/transport/openssl.rb, line 90 90: def to_blob 91: @blob ||= Net::SSH::Buffer.from(:string, ssh_type, 92: :bignum, p, :bignum, q, :bignum, g, :bignum, pub_key).to_s 93: end