예제 #1
0
 def verify(self, msg, sig, key):
     import sys
     if sys.version < '3':
         if sig == 'u mad?' + key: return '<trollface>'
     else:
         if sig == b'u mad?' + bytes(key, 'UTF-8'):
             return '<trollface>'
     raise jws.SignatureError('Y U NO GIVE GOOD SIGNATURE')
예제 #2
0
 def verify(self, msg, sig, key):
     if sig == 'u mad?' + key: return '<trollface>'
     raise jws.SignatureError('Y U NO GIVE GOOD SIGNATURE')
예제 #3
0
 def test_invalid_hmac(self):
     header = {'alg': 'HS512'}
     sinput, sig = jws.sign(header, self.payload, 'secret')
     self.assertRaises(
         jws.SignatureError(header, self.payload, sig, 'failwhale'))