Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect AES key length (12 bytes) #2

Open
yashkhare0 opened this issue Jun 23, 2020 · 0 comments
Open

Incorrect AES key length (12 bytes) #2

yashkhare0 opened this issue Jun 23, 2020 · 0 comments

Comments

@yashkhare0
Copy link

Cannot fix this ValueError in utils.py

File "C:\Users\yashk\Dev\ecom\env\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "C:\Users\yashk\Dev\ecom\env\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Users\yashk\Dev\ecom\env\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\yashk\Dev\ecom\env\lib\site-packages\django\views\generic\base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "C:\Users\yashk\Dev\ecom\env\lib\site-packages\django\utils\decorators.py", line 43, in _wrapper
return bound_method(*args, **kwargs)
File "C:\Users\yashk\Dev\ecom\env\lib\site-packages\django\views\decorators\csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "C:\Users\yashk\Dev\ecom\env\lib\site-packages\django\contrib\auth\mixins.py", line 52, in dispatch
return super().dispatch(request, *args, **kwargs)
File "C:\Users\yashk\Dev\ecom\env\lib\site-packages\django\views\generic\base.py", line 97, in dispatch
return handler(request, *args, **kwargs)
File "C:\Users\yashk\Dev\ecom\env\lib\site-packages\django\views\generic\base.py", line 158, in get
context = self.get_context_data(**kwargs)
File "C:\Users\yashk\Dev\ecom\paytm\views.py", line 53, in get_context_data
'CHECKSUMHASH': generate_checksum(ctx['paytm_req_data'], settings.PAYTM_MERCHANT_KEY)
File "C:\Users\yashk\Dev\ecom\paytm\utils.py", line 23, in generate_checksum
return encode(hash_string, IV, merchant_key)
File "C:\Users\yashk\Dev\ecom\paytm\utils.py", line 108, in encode
c = AES.new(key.encode('utf-8'), AES.MODE_CBC, iv.encode('utf-8'))
File "C:\Users\yashk\Dev\ecom\env\lib\site-packages\Crypto\Cipher\AES.py", line 232, in new
return create_cipher(sys.modules[name], key, mode, *args, **kwargs)
File "C:\Users\yashk\Dev\ecom\env\lib\site-packages\Crypto\Cipher_init
.py", line 79, in _create_cipher
return modes[mode](factory, **kwargs)
File "C:\Users\yashk\Dev\ecom\env\lib\site-packages\Crypto\Cipher_mode_cbc.py", line 274, in _create_cbc_cipher
cipher_state = factory._create_base_cipher(kwargs)
File "C:\Users\yashk\Dev\ecom\env\lib\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 (12 bytes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant