@@ -193,13 +193,13 @@ def test_hmac_from_keyrep():
193
193
194
194
195
195
def test_left_hash_hs256 ():
196
- hsh = jws .left_hash (b 'Please take a moment to register today' )
197
- assert hsh == b 'rCFHVJuxTqRxOsn2IUzgvA'
196
+ hsh = jws .left_hash ('Please take a moment to register today' )
197
+ assert hsh == 'rCFHVJuxTqRxOsn2IUzgvA'
198
198
199
199
200
200
def test_left_hash_hs512 ():
201
- hsh = jws .left_hash (b 'Please take a moment to register today' , "HS512" )
202
- assert hsh == b '_h6feWLt8zbYcOFnaBmekTzMJYEHdVTaXlDgJSWsEeY'
201
+ hsh = jws .left_hash ('Please take a moment to register today' , "HS512" )
202
+ assert hsh == '_h6feWLt8zbYcOFnaBmekTzMJYEHdVTaXlDgJSWsEeY'
203
203
204
204
205
205
def test_rs256 ():
@@ -349,7 +349,7 @@ def test_signer_ps256_fail():
349
349
keys = [RSAKey (key = import_rsa_key_from_file (KEY ))]
350
350
#keys[0]._keytype = "private"
351
351
_jws = JWS (payload , alg = "PS256" )
352
- _jwt = _jws .sign_compact (keys )[:- 5 ] + b 'abcde'
352
+ _jwt = _jws .sign_compact (keys )[:- 5 ] + 'abcde'
353
353
354
354
_rj = JWS ()
355
355
try :
@@ -428,9 +428,9 @@ def test_signer_protected_headers():
428
428
429
429
exp_protected = protected .copy ()
430
430
exp_protected ['alg' ] = 'ES256'
431
- enc_header , enc_payload , sig = _jwt .split (b '.' )
432
- assert json .loads (b64d (enc_header ).decode ("utf-8" )) == exp_protected
433
- assert b64d (enc_payload ).decode ("utf-8" ) == payload
431
+ enc_header , enc_payload , sig = _jwt .split ('.' )
432
+ assert json .loads (b64d (enc_header . encode ( "utf-8" ) ).decode ("utf-8" )) == exp_protected
433
+ assert b64d (enc_payload . encode ( "utf-8" ) ).decode ("utf-8" ) == payload
434
434
435
435
_rj = JWS ()
436
436
info = _rj .verify_compact (_jwt , keys )
@@ -444,7 +444,7 @@ def test_verify_protected_headers():
444
444
protected = dict (header1 = u"header1 is protected" ,
445
445
header2 = "header2 is protected too" , a = 1 )
446
446
_jwt = _jws .sign_compact (keys , protected = protected )
447
- protectedHeader , enc_payload , sig = _jwt .split (b "." )
447
+ protectedHeader , enc_payload , sig = _jwt .split ("." )
448
448
data = dict (payload = enc_payload , signatures = [
449
449
dict (
450
450
header = dict (alg = u"ES256" , jwk = _key .serialize ()),
0 commit comments