11# from __future__ import print_function
2+ import array
23import hashlib
34import os
45import string
56import sys
6- import array
77
88import pytest
99from cryptography .hazmat .backends import default_backend
1414from cryptojwt .exception import MissingKey
1515from cryptojwt .exception import Unsupported
1616from cryptojwt .exception import VerificationError
17+ from cryptojwt .jwe .aes import AES_CBCEncrypter
18+ from cryptojwt .jwe .aes import AES_GCMEncrypter
1719from cryptojwt .jwe .exception import NoSuitableDecryptionKey
1820from cryptojwt .jwe .exception import NoSuitableEncryptionKey
1921from cryptojwt .jwe .exception import UnsupportedBitLength
2022from cryptojwt .jwe .exception import WrongEncryptionAlgorithm
21- from cryptojwt .utils import b64e , as_bytes
22-
23- from cryptojwt .jwe .aes import AES_CBCEncrypter
24- from cryptojwt .jwe .aes import AES_GCMEncrypter
2523from cryptojwt .jwe .jwe import JWE
2624from cryptojwt .jwe .jwe import factory
2725from cryptojwt .jwe .jwe_ec import JWE_EC
28- from cryptojwt .jwe .jwe_rsa import JWE_RSA
2926from cryptojwt .jwe .jwe_hmac import JWE_SYM
27+ from cryptojwt .jwe .jwe_rsa import JWE_RSA
3028from cryptojwt .jwe .utils import split_ctx_and_tag
31-
3229from cryptojwt .jwk .ec import ECKey
3330from cryptojwt .jwk .hmac import SYMKey
34- from cryptojwt .jwk .rsa import import_private_rsa_key_from_file
3531from cryptojwt .jwk .rsa import RSAKey
36-
32+ from cryptojwt .jwk .rsa import import_private_rsa_key_from_file
33+ from cryptojwt .utils import as_bytes
34+ from cryptojwt .utils import b64e
3735
3836__author__ = 'rohe0002'
3937
@@ -129,8 +127,8 @@ def test_jwe_09_a1():
129127 assert bytes2intarr (tag ) == [130 , 17 , 32 , 198 , 120 , 167 , 144 , 113 , 0 ,
130128 50 , 158 , 49 , 102 , 208 , 118 , 152 ]
131129
132- #tag = long2hexseq(tag)
133- #iv = long2hexseq(iv)
130+ # tag = long2hexseq(tag)
131+ # iv = long2hexseq(iv)
134132 res = b"." .join ([b64_header , b64_ejek , b64e (iv ), b64e (ctxt ), b64e (tag )])
135133
136134 # print(res.split(b'.'))
@@ -154,7 +152,7 @@ def test_aesgcm_bit_length():
154152 enc_msg = encrypter .encrypt (b'Murder must advertise.' ,
155153 b'Dorothy L. Sayers' )
156154 ctx , tag = split_ctx_and_tag (enc_msg )
157- _msg = encrypter .decrypt (ctx , iv = b'Dorothy L. Sayers' ,tag = tag )
155+ _msg = encrypter .decrypt (ctx , iv = b'Dorothy L. Sayers' , tag = tag )
158156 assert _msg == b'Murder must advertise.'
159157
160158
0 commit comments