From be5542c05e46b500e47b94bc8a6254cae8335a8b Mon Sep 17 00:00:00 2001 From: "Jeremy T. Bouse" Date: Sun, 29 May 2011 08:16:54 -0400 Subject: Imported Upstream version 1.7.7.1 --- docs/paramiko.rsakey-pysrc.html | 162 ++++++++++++++++++---------------------- 1 file changed, 71 insertions(+), 91 deletions(-) (limited to 'docs/paramiko.rsakey-pysrc.html') diff --git a/docs/paramiko.rsakey-pysrc.html b/docs/paramiko.rsakey-pysrc.html index d1dd96a..8deccb5 100644 --- a/docs/paramiko.rsakey-pysrc.html +++ b/docs/paramiko.rsakey-pysrc.html @@ -197,98 +197,78 @@ paramiko.RSAKey.get_name" class="py-name" href="#" onclick="return doclink('link 137 @return: new private key 138 @rtype: L{RSAKey} 139 """ -140 randpool.stir() -141 rsa = RSA.generate(bits, randpool.get_bytes, progress_func) -142 key = RSAKey(vals=(rsa.e, rsa.n)) -143 key.d = rsa.d -144 key.p = rsa.p -145 key.q = rsa.q -146 return key -147 generate = staticmethod(generate) +140 rsa = RSA.generate(bits, rng.read, progress_func) +141 key = RSAKey(vals=(rsa.e, rsa.n)) +142 key.d = rsa.d +143 key.p = rsa.p +144 key.q = rsa.q +145 return key +146 generate = staticmethod(generate) +147 148 -149 -150 ### internals... +149 ### internals... +150 151 -152 -
153 - def _pkcs1imify(self, data): -
154 """ -155 turn a 20-byte SHA1 hash into a blob of data as large as the key's N, -156 using PKCS1's \"emsa-pkcs1-v1_5\" encoding. totally bizarre. -157 """ -158 SHA1_DIGESTINFO = '\x30\x21\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a\x05\x00\x04\x14' -159 size = len(util.deflate_long(self.n, 0)) -160 filler = '\xff' * (size - len(SHA1_DIGESTINFO) - len(data) - 3) -161 return '\x00\x01' + filler + '\x00' + SHA1_DIGESTINFO + data -
162 -
163 - def _from_private_key_file(self, filename, password): -
164 data = self._read_private_key_file('RSA', filename, password) -165 self._decode_key(data) -
166 -
167 - def _from_private_key(self, file_obj, password): -
168 data = self._read_private_key('RSA', file_obj, password) -169 self._decode_key(data) -
170 -
171 - def _decode_key(self, data): -
172 # private key file contains: -173 # RSAPrivateKey = { version = 0, n, e, d, p, q, d mod p-1, d mod q-1, q**-1 mod p } -174 try: -175 keylist = BER(data).decode() -176 except BERException: -177 raise SSHException('Unable to parse key file') -178 if (type(keylist) is not list) or (len(keylist) < 4) or (keylist[0] != 0): -179 raise SSHException('Not a valid RSA private key file (bad ber encoding)') -180 self.n = keylist[1] -181 self.e = keylist[2] -182 self.d = keylist[3] -183 # not really needed -184 self.p = keylist[4] -185 self.q = keylist[5] -186 self.size = util.bit_length(self.n) -
187