diff options
author | David Gouldin <david@gould.in> | 2012-03-12 21:35:35 -0700 |
---|---|---|
committer | David Gouldin <david@gould.in> | 2012-03-12 21:35:43 -0700 |
commit | d9ff221a9165eb645f64fa03893cc9b59599469f (patch) | |
tree | 6c0ffd6297ff7e77444f53b86a51421c01e25721 | |
parent | 09eb08defedb495fae0560498b08aef081b6ecd4 (diff) | |
download | oauthlib-d9ff221a9165eb645f64fa03893cc9b59599469f.tar.gz |
Fixing a couple of bugs in RSA signing.
-rw-r--r-- | oauthlib/oauth.py | 3 | ||||
-rw-r--r-- | oauthlib/signature.py | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/oauthlib/oauth.py b/oauthlib/oauth.py index 847ec0a..11850db 100644 --- a/oauthlib/oauth.py +++ b/oauthlib/oauth.py @@ -37,6 +37,9 @@ class OAuthClient(object): self.rsa_key = rsa_key self.verifier = verifier + if self.signature_method == SIGNATURE_RSA and self.rsa_key is None: + raise ValueError('rsa_key is required when using RSA signature method.') + def get_oauth_signature(self, uri, http_method=u'GET', body=None, authorization_header=None): """Get an OAuth signature to be used in signing a request""" diff --git a/oauthlib/signature.py b/oauthlib/signature.py index b1c5223..1499dfa 100644 --- a/oauthlib/signature.py +++ b/oauthlib/signature.py @@ -137,7 +137,7 @@ def sign_rsa_sha1(base_string, rsa_private_key): from Crypto.Signature import PKCS1_v1_5 from Crypto.Hash import SHA - key = RSA.importKey(private_rsa) + key = RSA.importKey(rsa_private_key) h = SHA.new(base_string) p = PKCS1_v1_5.new(key) return binascii.b2a_base64(p.sign(h))[:-1].decode('utf-8') |