[project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-34]

fix some arcana in unpacking private keys
"!= type([])" is a pretty obscure way to say it.  let's try "is not list"
which is a lot more readable.

(mostly this is a test to make sure tla is working okay on my laptop.)
This commit is contained in:
Robey Pointer 2004-03-16 07:33:09 +00:00
parent 0ae801447e
commit f8a3a62136
2 changed files with 2 additions and 2 deletions

View File

@ -117,7 +117,7 @@ class DSSKey (PKey):
keylist = BER(data).decode() keylist = BER(data).decode()
except BERException: except BERException:
raise SSHException('Unable to parse key file') raise SSHException('Unable to parse key file')
if (type(keylist) != type([])) or (len(keylist) < 6) or (keylist[0] != 0): if (type(keylist) is not list) or (len(keylist) < 6) or (keylist[0] != 0):
raise SSHException('not a valid DSA private key file (bad ber encoding)') raise SSHException('not a valid DSA private key file (bad ber encoding)')
self.p = keylist[1] self.p = keylist[1]
self.q = keylist[2] self.q = keylist[2]

View File

@ -104,7 +104,7 @@ class RSAKey (PKey):
keylist = BER(data).decode() keylist = BER(data).decode()
except BERException: except BERException:
raise SSHException('Unable to parse key file') raise SSHException('Unable to parse key file')
if (type(keylist) != type([])) or (len(keylist) < 4) or (keylist[0] != 0): if (type(keylist) is not list) or (len(keylist) < 4) or (keylist[0] != 0):
raise SSHException('Not a valid RSA private key file (bad ber encoding)') raise SSHException('Not a valid RSA private key file (bad ber encoding)')
self.n = keylist[1] self.n = keylist[1]
self.e = keylist[2] self.e = keylist[2]