Class OpenSSL::PKey::DSA
In: lib/net/ssh/transport/openssl.rb
lib/net/ssh/transport/openssl.rb
Parent: Object

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.

Methods

Public Instance methods

Signs the given data.

[Source]

     # File lib/net/ssh/transport/openssl.rb, line 108
108:       def ssh_do_sign(data)
109:         sig = sign( OpenSSL::Digest::DSS1.new, data)
110:         a1sig = OpenSSL::ASN1.decode( sig )
111: 
112:         sig_r = a1sig.value[0].value.to_s(2)
113:         sig_s = a1sig.value[1].value.to_s(2)
114: 
115:         if sig_r.length > 20 || sig_s.length > 20
116:           raise OpenSSL::PKey::DSAError, "bad sig size"
117:         end
118: 
119:         sig_r = "\0" * ( 20 - sig_r.length ) + sig_r if sig_r.length < 20
120:         sig_s = "\0" * ( 20 - sig_s.length ) + sig_s if sig_s.length < 20
121: 
122:         return sig_r + sig_s
123:       end

Signs the given data.

[Source]

     # File lib/net/ssh/transport/openssl.rb, line 108
108:       def ssh_do_sign(data)
109:         sig = sign( OpenSSL::Digest::DSS1.new, data)
110:         a1sig = OpenSSL::ASN1.decode( sig )
111: 
112:         sig_r = a1sig.value[0].value.to_s(2)
113:         sig_s = a1sig.value[1].value.to_s(2)
114: 
115:         if sig_r.length > 20 || sig_s.length > 20
116:           raise OpenSSL::PKey::DSAError, "bad sig size"
117:         end
118: 
119:         sig_r = "\0" * ( 20 - sig_r.length ) + sig_r if sig_r.length < 20
120:         sig_s = "\0" * ( 20 - sig_s.length ) + sig_s if sig_s.length < 20
121: 
122:         return sig_r + sig_s
123:       end

Verifies the given signature matches the given data.

[Source]

     # File lib/net/ssh/transport/openssl.rb, line 97
 97:       def ssh_do_verify(sig, data)
 98:         sig_r = sig[0,20].unpack("H*")[0].to_i(16)
 99:         sig_s = sig[20,20].unpack("H*")[0].to_i(16)
100:         a1sig = OpenSSL::ASN1::Sequence([
101:            OpenSSL::ASN1::Integer(sig_r),
102:            OpenSSL::ASN1::Integer(sig_s)
103:         ])
104:         return verify(OpenSSL::Digest::DSS1.new, a1sig.to_der, data)
105:       end

Verifies the given signature matches the given data.

[Source]

     # File lib/net/ssh/transport/openssl.rb, line 97
 97:       def ssh_do_verify(sig, data)
 98:         sig_r = sig[0,20].unpack("H*")[0].to_i(16)
 99:         sig_s = sig[20,20].unpack("H*")[0].to_i(16)
100:         a1sig = OpenSSL::ASN1::Sequence([
101:            OpenSSL::ASN1::Integer(sig_r),
102:            OpenSSL::ASN1::Integer(sig_s)
103:         ])
104:         return verify(OpenSSL::Digest::DSS1.new, a1sig.to_der, data)
105:       end

Returns "ssh-dss", which is the description of this key type used by the SSH2 protocol.

[Source]

    # File lib/net/ssh/transport/openssl.rb, line 86
86:       def ssh_type
87:         "ssh-dss"
88:       end

Returns "ssh-dss", which is the description of this key type used by the SSH2 protocol.

[Source]

    # File lib/net/ssh/transport/openssl.rb, line 86
86:       def ssh_type
87:         "ssh-dss"
88:       end

Converts the key to a blob, according to the SSH2 protocol.

[Source]

    # File lib/net/ssh/transport/openssl.rb, line 91
91:       def to_blob
92:         @blob ||= Net::SSH::Buffer.from(:string, ssh_type,
93:           :bignum, p, :bignum, q, :bignum, g, :bignum, pub_key).to_s
94:       end

Converts the key to a blob, according to the SSH2 protocol.

[Source]

    # File lib/net/ssh/transport/openssl.rb, line 91
91:       def to_blob
92:         @blob ||= Net::SSH::Buffer.from(:string, ssh_type,
93:           :bignum, p, :bignum, q, :bignum, g, :bignum, pub_key).to_s
94:       end

[Validate]