Class OpenSSL::BN
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

to_ssh   to_ssh  

Public Instance methods

Converts a BN object to a string. The format used is that which is required by the SSH2 protocol.

[Source]

    # File lib/net/ssh/transport/openssl.rb, line 13
13:     def to_ssh
14:       if zero?
15:         return [0].pack("N")
16:       else
17:         buf = to_s(2)
18:         if buf[0][7] == 1
19:           return [buf.length+1, 0, buf].pack("NCA*")
20:         else
21:           return [buf.length, buf].pack("NA*")
22:         end
23:       end
24:     end

Converts a BN object to a string. The format used is that which is required by the SSH2 protocol.

[Source]

    # File lib/net/ssh/transport/openssl.rb, line 13
13:     def to_ssh
14:       if zero?
15:         return [0].pack("N")
16:       else
17:         buf = to_s(2)
18:         if buf[0][7] == 1
19:           return [buf.length+1, 0, buf].pack("NCA*")
20:         else
21:           return [buf.length, buf].pack("NA*")
22:         end
23:       end
24:     end

[Validate]