diff options
author | Scott Maxwell <scott@codecobblers.com> | 2013-11-01 09:49:52 -0700 |
---|---|---|
committer | Scott Maxwell <scott@codecobblers.com> | 2013-11-01 09:49:52 -0700 |
commit | 9662a7f779636f0328263a81cdeb76af25802970 (patch) | |
tree | 0d0caa288159db9439e22039b21127201fc09017 /paramiko/rsakey.py | |
parent | 06b866cf406c035ecaffd7a8abd31d6e07b8811a (diff) | |
download | paramiko-9662a7f779636f0328263a81cdeb76af25802970.tar.gz |
Changes inspired by the nischu7 branch
Diffstat (limited to 'paramiko/rsakey.py')
-rw-r--r-- | paramiko/rsakey.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/paramiko/rsakey.py b/paramiko/rsakey.py index b4222a35..0a271198 100644 --- a/paramiko/rsakey.py +++ b/paramiko/rsakey.py @@ -32,6 +32,8 @@ from paramiko.ber import BER, BERException from paramiko.pkey import PKey from paramiko.ssh_exception import SSHException +SHA1_DIGESTINFO = unhexlify(b('3021300906052b0e03021a05000414')) + class RSAKey (PKey): """ @@ -92,7 +94,7 @@ class RSAKey (PKey): def sign_ssh_data(self, rpool, data): digest = SHA.new(data).digest() rsa = RSA.construct((long(self.n), long(self.e), long(self.d))) - sig = util.deflate_long(rsa.sign(self._pkcs1imify(digest), '')[0], 0) + sig = util.deflate_long(rsa.sign(self._pkcs1imify(digest), bytes())[0], 0) m = Message() m.add_string('ssh-rsa') m.add_string(sig) @@ -158,7 +160,6 @@ class RSAKey (PKey): turn a 20-byte SHA1 hash into a blob of data as large as the key's N, using PKCS1's \"emsa-pkcs1-v1_5\" encoding. totally bizarre. """ - SHA1_DIGESTINFO = unhexlify(b('3021300906052b0e03021a05000414')) size = len(util.deflate_long(self.n, 0)) filler = max_byte * (size - len(SHA1_DIGESTINFO) - len(data) - 3) return zero_byte + one_byte + filler + zero_byte + SHA1_DIGESTINFO + data |