Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

do not require ssh: only relevant to (therefore only imported when) a…

…llow_agent=True
  • Loading branch information...
commit 3d3b318f980c284b19a1cabef5be3c4840a52b04 1 parent 37472c0
@atl authored
View
2  CHANGES.rst
@@ -5,6 +5,8 @@ Changes
~~~~~~~~~~~~~~~~~~
* Stop enabling `allow_agent` by default
+* Stop requiring `ssh` library by default -- only when `allow_agent=True`
* Changed logic around ssh-agent: if one key is available, don't bother with any other method
* Changed logic around key file usage: if decryption fails, prompt for password
+* Bug fix: ssh-agent resulted in a nonsensical error if it found no correct keys
* Introduce versioneer.py
View
2  README.rst
@@ -7,10 +7,10 @@ Requirements
------------
* PyCrypto
-* ssh (for ssh-agent integration)
Optional:
+* ssh (for ssh-agent integration)
* requests
Usage
View
5 http_signature/sign.py
@@ -9,8 +9,6 @@
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
-import ssh
-
from .utils import sig, is_rsa
ALGORITHMS = frozenset(['rsa-sha1', 'rsa-sha256', 'rsa-sha512', 'hmac-sha1', 'hmac-sha256', 'hmac-sha512'])
@@ -26,6 +24,7 @@ def __init__(self, secret='~/.ssh/id_rsa', algorithm='rsa-sha256', allow_agent=F
self._hash = None
self.sign_algorithm, self.hash_algorithm = algorithm.split('-')
if allow_agent:
+ import ssh
keys = ssh.Agent().get_keys()
self._keys = filter(is_rsa, keys)
if self._keys:
@@ -93,7 +92,7 @@ class HeaderSigner(object):
algorithm is one of the six specified algorithms
headers is a list of http headers to be included in the signing string, defaulting to "Date" alone.
'''
- def __init__(self, key_id='~/.ssh/id_rsa', secret='', algorithm='rsa-sha256',
+ def __init__(self, key_id='~/.ssh/id_rsa', secret='~/.ssh/id_rsa', algorithm='rsa-sha256',
headers=None, allow_agent=False):
self.signer = Signer(secret=secret, algorithm=algorithm, allow_agent=allow_agent)
self.key_id = key_id
View
1  requirements.txt
@@ -1,2 +1 @@
PyCrypto
-ssh
View
2  setup.py
@@ -34,5 +34,5 @@
packages=find_packages(),
include_package_data=True,
zip_safe=True,
- install_requires=['pycrypto', 'ssh'],
+ install_requires=['pycrypto'],
)
Please sign in to comment.
Something went wrong with that request. Please try again.