Skip to content

ValueError: IV must be 16 bytes long #16

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

Closed
BlackPreacher opened this issue Jan 31, 2021 · 2 comments
Closed

ValueError: IV must be 16 bytes long #16

BlackPreacher opened this issue Jan 31, 2021 · 2 comments

Comments

@BlackPreacher
Copy link

If I try to save a note for one day, I always get an error-message "There was an error saving. Please try again". In the docker logs I see the python error "ValueError: IV must be 16 bytes long".

I appears if I build the container myself from the cloned github repo, or if I pull the "offical" dockerimage from docker hub. Does anyone other gets these errors?

One complete logoutput is:

server_1  | Traceback (most recent call last):
server_1  |   File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
server_1  |     response = self.full_dispatch_request()
server_1  |   File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
server_1  |     rv = self.handle_user_exception(e)
server_1  |   File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
server_1  |     reraise(exc_type, exc_value, tb)
server_1  |   File "/usr/local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
server_1  |     raise value
server_1  |   File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
server_1  |     rv = self.dispatch_request()
server_1  |   File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
server_1  |     return self.view_functions[rule.endpoint](**req.view_args)
server_1  |   File "/usr/local/lib/python3.8/site-packages/flask_jwt_extended/view_decorators.py", line 108, in wrapper
server_1  |     return fn(*args, **kwargs)
server_1  |   File "/app/app/routes.py", line 72, in save_day
server_1  |     enc_date = aes_encrypt(title)
server_1  |   File "/app/app/models.py", line 18, in aes_encrypt
server_1  |     cipher = AES.new(key, AES.MODE_CFB, key[::-1])
server_1  |   File "/usr/local/lib/python3.8/site-packages/Crypto/Cipher/AES.py", line 95, in new
server_1  |     return AESCipher(key, *args, **kwargs)
server_1  |   File "/usr/local/lib/python3.8/site-packages/Crypto/Cipher/AES.py", line 59, in __init__
server_1  |     blockalgo.BlockAlgo.__init__(self, _AES, key, *args, **kwargs)
server_1  |   File "/usr/local/lib/python3.8/site-packages/Crypto/Cipher/blockalgo.py", line 141, in __init__
server_1  |     self._cipher = factory.new(key, *args, **kwargs)
server_1  | ValueError: IV must be 16 bytes long 

Thanks for helping

@patchedsoul
Copy link

See #17

That should fix your issue. Also ensure your key is a multiple of 16

@BlackPreacher
Copy link
Author

Thanks alot, now it works without any problems

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

2 participants