summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2018-04-19 13:46:39 -0700
committerJeff Forcier <jeff@bitprophet.org>2018-04-19 13:46:39 -0700
commita31818c28556055341ae3d249e3893d40eb2b232 (patch)
tree2bef54426fdac65a25f95c3400b8d20959979b6f
parentf68f3b5526db620fd815589312c453c8a83962b1 (diff)
downloadparamiko-a31818c28556055341ae3d249e3893d40eb2b232.tar.gz
Make pyasn1 a truly optional dependency
Re: #1191
-rw-r--r--paramiko/ssh_gss.py7
-rw-r--r--setup.py1
2 files changed, 5 insertions, 3 deletions
diff --git a/paramiko/ssh_gss.py b/paramiko/ssh_gss.py
index 88dedf7e..aa7cc74d 100644
--- a/paramiko/ssh_gss.py
+++ b/paramiko/ssh_gss.py
@@ -42,8 +42,6 @@ GSS_AUTH_AVAILABLE = True
GSS_EXCEPTIONS = ()
-from pyasn1.type.univ import ObjectIdentifier
-from pyasn1.codec.der import encoder, decoder
#: :var str _API: Constraint for the used API
@@ -160,6 +158,8 @@ class _SSH_GSSAuth(object):
:note: In server mode we just return the OID length and the DER encoded
OID.
"""
+ from pyasn1.type.univ import ObjectIdentifier
+ from pyasn1.codec.der import encoder
OIDs = self._make_uint32(1)
krb5_OID = encoder.encode(ObjectIdentifier(self._krb5_mech))
OID_len = self._make_uint32(len(krb5_OID))
@@ -174,6 +174,7 @@ class _SSH_GSSAuth(object):
:param str desired_mech: The desired GSS-API mechanism of the client
:return: ``True`` if the given OID is supported, otherwise C{False}
"""
+ from pyasn1.codec.der import decoder
mech, __ = decoder.decode(desired_mech)
if mech.__str__() != self._krb5_mech:
return False
@@ -260,6 +261,7 @@ class _SSH_GSSAPI(_SSH_GSSAuth):
:return: A ``String`` if the GSS-API has returned a token or
``None`` if no token was returned
"""
+ from pyasn1.codec.der import decoder
self._username = username
self._gss_host = target
targ_name = gssapi.Name("host@" + self._gss_host,
@@ -428,6 +430,7 @@ class _SSH_SSPI(_SSH_GSSAuth):
:return: A ``String`` if the SSPI has returned a token or ``None`` if
no token was returned
"""
+ from pyasn1.codec.der import decoder
self._username = username
self._gss_host = target
error = 0
diff --git a/setup.py b/setup.py
index 6e1f0e0e..01150831 100644
--- a/setup.py
+++ b/setup.py
@@ -75,6 +75,5 @@ setup(
'bcrypt>=3.1.3',
'cryptography>=1.5',
'pynacl>=1.0.1',
- 'pyasn1>=0.1.7',
],
)