#NEWLINE# def ssh_KEXINIT( self , packet ) : #NEWLINE# #INDENT# '\n        Called when we receive a MSG_KEXINIT message.  For a description\n        of the packet, see SSHTransportBase.ssh_KEXINIT().  Additionally,\n        this method sends the first key exchange packet.  If the agreed-upon\n        exchange has a fixed prime/generator group, generate a public key\n        and send it in a MSG_KEXDH_INIT message. Otherwise, ask for a 2048\n        bit group with a MSG_KEX_DH_GEX_REQUEST message.\n        ' #NEWLINE# if ( SSHTransportBase . ssh_KEXINIT ( self , packet ) is None ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# if _kex . isFixedGroup ( self . kexAlg ) : #NEWLINE# #INDENT# self . x = _generateX ( randbytes . secureRandom , 512 ) #NEWLINE# ( self . g , self . p ) = _kex . getDHGeneratorAndPrime ( self . kexAlg ) #NEWLINE# self . e = _MPpow ( self . g , packet . x , self . p ) #NEWLINE# self . sendPacket ( MSG_KEXDH_INIT , self . e ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . sendPacket ( MSG_KEX_DH_GEX_REQUEST , struct . pack ( '!LLL' , self . _dhMinimalGroupSize , self . _dhPreferredGroupSize , self . _dhMaximalGroupSize ) )