Class OpenSSL::BN

  1. 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

  1. to_ssh

Public instance methods

to_ssh ()

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

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