Skip to content

Commit

Permalink
Make pyasn1 a truly optional dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
bitprophet committed Apr 19, 2018
1 parent f68f3b5 commit a31818c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 5 additions & 2 deletions paramiko/ssh_gss.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
GSS_EXCEPTIONS = ()


from pyasn1.type.univ import ObjectIdentifier
from pyasn1.codec.der import encoder, decoder


#: :var str _API: Constraint for the used API
Expand Down Expand Up @@ -160,6 +158,8 @@ def ssh_gss_oids(self, mode="client"):
: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))
Expand All @@ -174,6 +174,7 @@ def ssh_check_mech(self, desired_mech):
: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
Expand Down Expand Up @@ -260,6 +261,7 @@ def ssh_init_sec_context(self, target, desired_mech=None,
: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,
Expand Down Expand Up @@ -428,6 +430,7 @@ def ssh_init_sec_context(self, target, desired_mech=None,
: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
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,5 @@
'bcrypt>=3.1.3',
'cryptography>=1.5',
'pynacl>=1.0.1',
'pyasn1>=0.1.7',
],
)

0 comments on commit a31818c

Please sign in to comment.