File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,6 @@ def get_algorithm_object(algorithm):
1010 """
1111 Returns an algorithm object for the given algorithm.
1212 """
13- if algorithm not in ALGORITHMS .SUPPORTED :
14- raise JWSError ('Algorithm not supported: %s' % algorithm )
1513
1614 if algorithm == ALGORITHMS .HS256 :
1715 return HMACAlgorithm (HMACAlgorithm .SHA256 )
@@ -31,4 +29,4 @@ def get_algorithm_object(algorithm):
3129 if algorithm == ALGORITHMS .RS512 :
3230 return RSAAlgorithm (RSAAlgorithm .SHA512 )
3331
34- raise JWSError ('No algorithm found for %s. ' % algorithm )
32+ raise JWSError ('Algorithm not supported: %s ' % algorithm )
Original file line number Diff line number Diff line change @@ -46,6 +46,10 @@ def test_claims_not_json(self):
4646 with pytest .raises (JWSError ):
4747 jws .verify (token , 'secret' , ['HS256' ])
4848
49+ def test_invalid_key (self , claims ):
50+ with pytest .raises (JWSError ):
51+ jws .sign (claims , 'secret' , algorithm = 'RS256' )
52+
4953
5054class TestHMAC :
5155
You can’t perform that action at this time.
0 commit comments