Exemplo n.º 1
0
Arquivo: app.py Projeto: khoama/pilbox
 def _validate_signature(self):
     key = self.settings.get("client_key")
     if key and not verify_signature(key, urlparse(self.request.uri).query):
         raise errors.SignatureError("Invalid signature")
Exemplo n.º 2
0
 def test_bad_signature(self):
     key1 = "abc123"
     key2 = "def456"
     qs_list = ["x=1&y=2&z=3", "x=%20%2B%2F!%40%23%24%25%5E%26"]
     for qs in qs_list:
         self.assertFalse(verify_signature(key1, sign(key2, qs)))
Exemplo n.º 3
0
 def _validate_signature(self):
     key = self.settings.get("client_key")
     if key and not verify_signature(key, urlparse(self.request.uri).query):
         raise errors.SignatureError("Invalid signature")
Exemplo n.º 4
0
 def test_verify(self):
     key = "abc123"
     qs_list = ["x=1&y=2&z=3", "x=%20%2B%2F!%40%23%24%25%5E%26"]
     for qs in qs_list:
         self.assertTrue(verify_signature(key, sign(key, qs)))