Этот код дает неверную ошибку длины ключа AES на стороне сервера. Как я могу это исправить? Сервер создается после того, как сообщение отправляется с клиентской стороны, сервер получает ошибку.
Код сервера:
File "/home/saurabh/.local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/home/saurabh/.local/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/saurabh/.local/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/saurabh/project/myshop/shopingsite/shop/views.py", line 126, in checkout
param_dict['CHECKSUMHASH'] = Checksum.generate_checksum(param_dict, MERCHANT_KEY)
File "/home/saurabh/project/myshop/shopingsite/PayTm/Checksum.py", line 24, in generate_checksum
return __encode__(hash_string, IV, merchant_key)
File "/home/saurabh/project/myshop/shopingsite/PayTm/Checksum.py", line 103, in __encode__
c = AES.new(key.encode('utf-8'), AES.MODE_CBC, iv.encode('utf-8'))
File "/home/saurabh/.local/lib/python3.6/site-packages/Crypto/Cipher/AES.py", line 232, in new
return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
File "/home/saurabh/.local/lib/python3.6/site-packages/Crypto/Cipher/__init__.py", line 79, in _create_cipher
return modes[mode](factory, **kwargs)
File "/home/saurabh/.local/lib/python3.6/site-packages/Crypto/Cipher/_mode_cbc.py", line 274, in _create_cbc_cipher
cipher_state = factory._create_base_cipher(kwargs)
File "/home/saurabh/.local/lib/python3.6/site-packages/Crypto/Cipher/AES.py", line 93, in _create_base_cipher
raise ValueError("Incorrect AES key length (%d bytes)" % len(key))
ValueError: Incorrect AES key length (22 bytes)
[01/Apr/2020 06:33:08] "POST /shop/checkout/ HTTP/1.1" 500 101430