[Python 3]: Workaround for long values in Python 3's unified integer types. paramiko.message not worked around for now.
This commit is contained in:
parent
1022eec17a
commit
cc2dd9c0f4
|
@ -19,6 +19,8 @@
|
|||
from __future__ import absolute_import
|
||||
from paramiko import util
|
||||
|
||||
import six
|
||||
|
||||
|
||||
class BERException (Exception):
|
||||
pass
|
||||
|
@ -112,7 +114,7 @@ class BER(object):
|
|||
self.encode_tlv(1, '\xff')
|
||||
else:
|
||||
self.encode_tlv(1, '\x00')
|
||||
elif (type(x) is int) or (type(x) is long):
|
||||
elif isinstance(x, six.integer_types):
|
||||
self.encode_tlv(2, util.deflate_long(x))
|
||||
elif type(x) is str:
|
||||
self.encode_tlv(4, x)
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
L{DSSKey}
|
||||
"""
|
||||
|
||||
import six
|
||||
if six.PY3:
|
||||
long = lambda x: int(x)
|
||||
|
||||
from Crypto.PublicKey import DSA
|
||||
from Crypto.Hash import SHA
|
||||
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
Utility functions for dealing with primes.
|
||||
"""
|
||||
|
||||
import six
|
||||
if six.PY3:
|
||||
long = lambda x: int(x)
|
||||
from Crypto.Util import number
|
||||
|
||||
from paramiko import util
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
L{RSAKey}
|
||||
"""
|
||||
|
||||
import six
|
||||
if six.PY3:
|
||||
long = lambda x: int(x)
|
||||
|
||||
from Crypto.PublicKey import RSA
|
||||
from Crypto.Hash import SHA, MD5
|
||||
from Crypto.Cipher import DES3
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
Client-mode SFTP support.
|
||||
"""
|
||||
|
||||
import six
|
||||
if six.PY3:
|
||||
long = lambda x: int(x)
|
||||
|
||||
from binascii import hexlify
|
||||
import errno
|
||||
import os
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
L{SFTPFile}
|
||||
"""
|
||||
|
||||
import six
|
||||
if six.PY3:
|
||||
long = lambda x: int(x)
|
||||
|
||||
from binascii import hexlify
|
||||
from collections import deque
|
||||
import socket
|
||||
|
|
Loading…
Reference in New Issue