From f7b892905c62b94a6e54d115ee2d6d32d66af013 Mon Sep 17 00:00:00 2001 From: "Jeremy T. Bouse" Date: Fri, 27 Nov 2009 16:25:55 -0500 Subject: Imported Upstream version 1.7.6 Closes: #543784 --- docs/paramiko.kex_group1-pysrc.html | 116 ++++++++++++++++++------------------ 1 file changed, 58 insertions(+), 58 deletions(-) (limited to 'docs/paramiko.kex_group1-pysrc.html') diff --git a/docs/paramiko.kex_group1-pysrc.html b/docs/paramiko.kex_group1-pysrc.html index 1d32b96..a88ede3 100644 --- a/docs/paramiko.kex_group1-pysrc.html +++ b/docs/paramiko.kex_group1-pysrc.html @@ -54,24 +54,24 @@

Source Code for Module paramiko.kex_group1

-  1  # Copyright (C) 2003-2007  Robey Pointer <robey@lag.net> 
-  2  # 
-  3  # This file is part of paramiko. 
-  4  # 
-  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
-  6  # terms of the GNU Lesser General Public License as published by the Free 
-  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
-  8  # any later version. 
-  9  # 
- 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
- 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
- 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
- 13  # details. 
- 14  # 
- 15  # You should have received a copy of the GNU Lesser General Public License 
- 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
- 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
- 18   
+  1  # Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com> 
+  2  # 
+  3  # This file is part of paramiko. 
+  4  # 
+  5  # Paramiko is free software; you can redistribute it and/or modify it under the 
+  6  # terms of the GNU Lesser General Public License as published by the Free 
+  7  # Software Foundation; either version 2.1 of the License, or (at your option) 
+  8  # any later version. 
+  9  # 
+ 10  # Paramiko is distrubuted in the hope that it will be useful, but WITHOUT ANY 
+ 11  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 
+ 12  # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more 
+ 13  # details. 
+ 14  # 
+ 15  # You should have received a copy of the GNU Lesser General Public License 
+ 16  # along with Paramiko; if not, write to the Free Software Foundation, Inc., 
+ 17  # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. 
+ 18   
  19  """ 
  20  Standard SSH key exchange ("kex" if you wanna sound cool).  Diffie-Hellman of 
  21  1024 bit key halves, using a known "p" prime and "g" generator. 
@@ -88,7 +88,7 @@
  32  _MSG_KEXDH_INIT, _MSG_KEXDH_REPLY = range(30, 32) 
  33   
  34  # draft-ietf-secsh-transport-09.txt, page 17 
- 35  P = 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFFL 
+ 35  P = 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFFL 
  36  G = 2 
  37   
  38   
@@ -107,11 +107,11 @@ paramiko.kex_group1.KexGroup1.name" class="py-name" href="#" onclick="return doc
 
50 self._generate_x() 51 if self.transport.server_mode: 52 # compute f = g^x mod p, but don't send it yet - 53 self.f = pow(G, self.x, P) + 53 self.f = pow(G, self.x, P) 54 self.transport._expect_packet(_MSG_KEXDH_INIT) 55 return 56 # compute e = g^x mod p (where g=2), and send it - 57 self.e = pow(G, self.x, P) + 57 self.e = pow(G, self.x, P) 58 m = Message() 59 m.add_byte(chr(_MSG_KEXDH_INIT)) 60 m.add_mpint(self.e) @@ -127,15 +127,15 @@ paramiko.kex_group1.KexGroup1.name" class="py-name" href="#" onclick="return doc
70 71 72 ### internals... - 73 + 73 74
75 - def _generate_x(self):
76 # generate an "x" (1 < x < q), where q is (p-1)/2. - 77 # p is a 128-byte (1024-bit) number, where the first 64 bits are 1. - 78 # therefore q can be approximated as a 2^1023. we drop the subset of - 79 # potential x where the first 63 bits are 1, because some of those will be - 80 # larger than q (but this is a tiny tiny subset of potential x). - 81 while 1: + 77 # p is a 128-byte (1024-bit) number, where the first 64 bits are 1. + 78 # therefore q can be approximated as a 2^1023. we drop the subset of + 79 # potential x where the first 63 bits are 1, because some of those will be + 80 # larger than q (but this is a tiny tiny subset of potential x). + 81 while 1: 82 self.transport. 89
90 - def _parse_kexdh_reply(self, m):
91 # client mode - 92 host_key = m.get_string() + 92 host_key = m.get_string() 93 self.f = m.get_mpint() 94 if (self.f < 1) or (self.f > P - 1): 95 raise SSHException('Server kex "f" is out of range') 96 sig = m.get_string() 97 K = pow(self.f, self.x, P) 98 # okay, build up the hash H of (V_C || V_S || I_C || I_S || K_S || e || f || K) - 99 hm = Message() + 99 hm = Message() 100 hm.add(self.transport.local_version, self.transport.remote_version, 101 self.transport.local_kex_init, self.transport.remote_kex_init) @@ -202,33 +202,33 @@ paramiko.Message.add" class="py-name" href="#" onclick="return doclink('link-51' 103 hm.add_mpint(self.e) 104 hm.add_mpint(self.f) 105 hm.add_mpint(K) -106 self.transport._set_K_H(K, SHA.new(str(hm)).digest()) -107 self.transport._verify_key(host_key, sig) -108 self.transport._activate_outbound() +106 self.transport._set_K_H(K, SHA.new(str(hm)).digest()) +107 self.transport._verify_key(host_key, sig) +108 self.transport._activate_outbound()
109
110 - def _parse_kexdh_init(self, m):
111 # server mode -112 self.e = m.get_mpint() -113 if (self.e < 1) or (self.e > P - 1): -114 raise SSHException('Client kex "e" is out of range') -115 K = pow(self.e, self.x, P) -116 key = str(self.transport.get_server_key()) +112 self.e = m.get_mpint() +113 if (self.e < 1) or (self.e > P - 1): +114 raise SSHException('Client kex "e" is out of range') +115 K = pow(self.e, self.x, P) +116 key = str(self.transport.get_server_key()) 117 # okay, build up the hash H of (V_C || V_S || I_C || I_S || K_S || e || f || K) -118 hm = Message() -119 hm.add(self.transport.remote_version, self.transport.local_version, -120 self.transport.remote_kex_init, self.transport.local_kex_init) -121 hm.add_string(key) -122 hm.add_mpint(self.e) -123 hm.add_mpint(self.f) -124 hm.add_mpint(K) -125 H = SHA.new(str(hm)).digest() -126 self.transport._set_K_H(K, H) +118 hm = Message() +119 hm.add(self.transport.remote_version, self.transport.local_version, +120 self.transport.remote_kex_init, self.transport.local_kex_init) +121 hm.add_string(key) +122 hm.add_mpint(self.e) +123 hm.add_mpint(self.f) +124 hm.add_mpint(K) +125 H = SHA.new(str(hm)).digest() +126 self.transport._set_K_H(K, H) 127 # sign it -128 sig = self.transport.get_server_key().128 sig = self.transport.get_server_key().sign_ssh_data(self.transport.sign_ssh_data(self.transport.randpool, H) +paramiko.util.randpool" class="py-name" href="#" onclick="return doclink('link-86', 'randpool', 'link-37');">randpool, H) 129 # send reply -130 m = Message() -131 m.add_byte(chr(_MSG_KEXDH_REPLY)) -132 m.add_string(key) -133 m.add_mpint(self.f) -134 m.add_string(str(sig)) -135 self.transport._send_message(m) -136 self.transport._activate_outbound() +130 m = Message() +131 m.add_byte(chr(_MSG_KEXDH_REPLY)) +132 m.add_string(key) +133 m.add_mpint(self.f) +134 m.add_string(str(sig)) +135 self.transport._send_message(m) +136 self.transport._activate_outbound()
137