Skip to content
This repository was archived by the owner on Dec 15, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions httpsig_cffi/sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ def algorithm(self):

def _sign_rsa(self, data):
if isinstance(data, six.string_types): data = data.encode("ascii")
r = self._rsa_private.signer(padding.PKCS1v15(), self._rsahash())
r.update(data)
return r.finalize()
r = self._rsa_private.sign(data, padding.PKCS1v15(), self._rsahash())
return r

def _sign_hmac(self, data):
if isinstance(data, six.string_types): data = data.encode("ascii")
Expand Down
2 changes: 1 addition & 1 deletion httpsig_cffi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def get_fingerprint(key):
if key.startswith('ssh-rsa'):
key = key.split(' ')[1]
else:
regex = r'\-{4,5}[\w|| ]+\-{4,5}'
regex = r'\-{4,5}[\w\|\| ]+\-{4,5}'
key = re.split(regex, key)[1]

key = key.replace('\n', '')
Expand Down
6 changes: 1 addition & 5 deletions httpsig_cffi/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,8 @@ def _verify(self, data, signature):

if self.sign_algorithm == 'rsa':

h = self._rsa_public.verifier(b64decode(signature),
padding.PKCS1v15(),
self._rsahash())
h.update(data)
try:
h.verify()
h = self._rsa_public.verify(b64decode(signature), data, padding.PKCS1v15(), self._rsahash())
return True
except InvalidSignature:
return False
Expand Down