diff options
author | Robey Pointer <robey@lag.net> | 2003-12-30 07:18:20 +0000 |
---|---|---|
committer | Robey Pointer <robey@lag.net> | 2003-12-30 07:18:20 +0000 |
commit | 48c7d888a22a6810a32f6d25cdd6b561803166cd (patch) | |
tree | 33e22ab7a6f56ef6b569c674817127bb1108f7dd /paramiko/kex_gex.py | |
parent | 36d6d95dc6db1f47d187b87ab1c1a10c1d30558f (diff) | |
download | paramiko-48c7d888a22a6810a32f6d25cdd6b561803166cd.tar.gz |
[project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-17]
lots more documentation, and added Transport.connect()
renamed demo_host_key to demo_rsa_key. moved changelog to a separate file,
and indicated that future changelog entries should be fetched from tla.
tried to clean up "__all__" in a way that makes epydoc still work.
added lots more documentation, and renamed many methods and vars to hide
them as private non-exported API.
Transport's ModulusPack is now a static member, so it only has to be loaded
once, and can then be used by any future Transport object.
added Transport.connect(), which tries to wrap all the SSH2 negotiation and
authentication into one method. you should be able to create a Transport,
call connect(), and then create channels.
Diffstat (limited to 'paramiko/kex_gex.py')
-rw-r--r-- | paramiko/kex_gex.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/paramiko/kex_gex.py b/paramiko/kex_gex.py index 5e02bab7..f14c7864 100644 --- a/paramiko/kex_gex.py +++ b/paramiko/kex_gex.py @@ -7,12 +7,12 @@ from message import Message from util import inflate_long, deflate_long, bit_length from ssh_exception import SSHException -from transport import MSG_NEWKEYS +from transport import _MSG_NEWKEYS from Crypto.Hash import SHA from Crypto.Util import number from logging import DEBUG -MSG_KEXDH_GEX_GROUP, MSG_KEXDH_GEX_INIT, MSG_KEXDH_GEX_REPLY, MSG_KEXDH_GEX_REQUEST = range(31, 35) +_MSG_KEXDH_GEX_GROUP, _MSG_KEXDH_GEX_INIT, _MSG_KEXDH_GEX_REPLY, _MSG_KEXDH_GEX_REQUEST = range(31, 35) class KexGex(object): @@ -27,27 +27,27 @@ class KexGex(object): def start_kex(self): if self.transport.server_mode: - self.transport._expect_packet(MSG_KEXDH_GEX_REQUEST) + self.transport._expect_packet(_MSG_KEXDH_GEX_REQUEST) return # request a bit range: we accept (min_bits) to (max_bits), but prefer # (preferred_bits). according to the spec, we shouldn't pull the # minimum up above 1024. m = Message() - m.add_byte(chr(MSG_KEXDH_GEX_REQUEST)) + m.add_byte(chr(_MSG_KEXDH_GEX_REQUEST)) m.add_int(self.min_bits) m.add_int(self.preferred_bits) m.add_int(self.max_bits) self.transport._send_message(m) - self.transport._expect_packet(MSG_KEXDH_GEX_GROUP) + self.transport._expect_packet(_MSG_KEXDH_GEX_GROUP) def parse_next(self, ptype, m): - if ptype == MSG_KEXDH_GEX_REQUEST: + if ptype == _MSG_KEXDH_GEX_REQUEST: return self._parse_kexdh_gex_request(m) - elif ptype == MSG_KEXDH_GEX_GROUP: + elif ptype == _MSG_KEXDH_GEX_GROUP: return self._parse_kexdh_gex_group(m) - elif ptype == MSG_KEXDH_GEX_INIT: + elif ptype == _MSG_KEXDH_GEX_INIT: return self._parse_kexdh_gex_init(m) - elif ptype == MSG_KEXDH_GEX_REPLY: + elif ptype == _MSG_KEXDH_GEX_REPLY: return self._parse_kexdh_gex_reply(m) raise SSHException('KexGex asked to handle packet type %d' % ptype) @@ -96,11 +96,11 @@ class KexGex(object): raise SSHException('Can\'t do server-side gex with no modulus pack') self.g, self.p = pack.get_modulus(min, preferred, max) m = Message() - m.add_byte(chr(MSG_KEXDH_GEX_GROUP)) + m.add_byte(chr(_MSG_KEXDH_GEX_GROUP)) m.add_mpint(self.p) m.add_mpint(self.g) self.transport._send_message(m) - self.transport._expect_packet(MSG_KEXDH_GEX_INIT) + self.transport._expect_packet(_MSG_KEXDH_GEX_INIT) def _parse_kexdh_gex_group(self, m): self.p = m.get_mpint() @@ -114,10 +114,10 @@ class KexGex(object): # now compute e = g^x mod p self.e = pow(self.g, self.x, self.p) m = Message() - m.add_byte(chr(MSG_KEXDH_GEX_INIT)) + m.add_byte(chr(_MSG_KEXDH_GEX_INIT)) m.add_mpint(self.e) self.transport._send_message(m) - self.transport._expect_packet(MSG_KEXDH_GEX_REPLY) + self.transport._expect_packet(_MSG_KEXDH_GEX_REPLY) def _parse_kexdh_gex_init(self, m): self.e = m.get_mpint() @@ -142,7 +142,7 @@ class KexGex(object): sig = self.transport.get_server_key().sign_ssh_data(self.transport.randpool, H) # send reply m = Message() - m.add_byte(chr(MSG_KEXDH_GEX_REPLY)) + m.add_byte(chr(_MSG_KEXDH_GEX_REPLY)) m.add_string(key) m.add_mpint(self.f) m.add_string(sig) |