BadSignature('Signature is not valid')
Romko775 opened this issue · 8 comments
After installation & adding to model
class SomeModel(models.Model):
email = encrypt(models.EmailField())
raises next error
Traceback (most recent call last):
File "XXX/env/lib/python3.7/site-packages/django_cryptography/core/signing.py", line 223, in unsign
version, timestamp, value, sig = struct.unpack(fmt, signed_value)
struct.error: bad char in struct format
During handling of the above exception, another exception occurred:
XXX/env/lib/python3.7/site-packages/django_cryptography/core/signing.py", line 225, in unsign
raise BadSignature('Signature is not valid')
what version of the library are you using?
I am getting the same error with:
- django-cryptography==1.0
- cryptography==3.0
- Django==3.0.8
- djangorestframework==3.11.0
Traceback (most recent call last):
File ".venv/lib/python3.8/site-packages/django_cryptography/core/signing.py", line 223, in unsign
version, timestamp, value, sig = struct.unpack(fmt, signed_value)
struct.error: bad char in struct format
File ".venv/lib/python3.8/site-packages/django_cryptography/core/signing.py", line 225, in unsign
raise BadSignature('Signature is not valid')
django.core.signing.BadSignature: Signature is not valid
But only because I had legacy, not encrypted data in the database for this field! After I deleted them and created new encrypted values, I no longer get this error! Might be worth adding some helpful hints about this in the error message or documentation.
After I deleted them and created new encrypted values, I no longer get this error!
How do I do this please? @Gilwyad @thismatters
This is happening in my production database so I can't just delete all data and start from scratch, but I could delete those specific fields because they are currently blank.
Please help, a significant part of my API is non-responsive because of this error.
I've followed along all the different tutorials and I'm still stuck:
When I experienced this I think the root cause was the python container that I was running in changed the way certain dependencies in the cryptography toolchain were presenting. I fixed the issue by upgrading my application to a more recent python release container (3.8).
Best of luck to you in troubleshooting this issue. Be aware that dependency changes up and down your stack can cause this issue. It likely does not mean that your data has been lost, but just that something changed.
I am getting this error :
FieldError at /
Unsupported lookup 'exact' for EncryptedCharField or join on the field not permitted, perhaps you meant exact or iexact?
Can someone please help me solve this?
Thank you.
@MuhammadShahryiar Please see #10
Given the nature of data encryption, anything other than
isnull
is not query-able. This is a side affect of encrypting the data in the first place, as the output will change even when the input does not.