Closed slyapustin closed 4 months ago
I can't say for certain that this isn't a bug, but is it possible your key changed between versions? Data decrypted with an incorrect key will just yield gibberish (there's no authentication) - see https://github.com/dcwatson/django-pgcrypto/blob/master/testapp/tests.py#L153
@dcwatson No, I don't think anything has been changed on my side other than django-pgcrypto.
The steps on my side to get UnicodeDecodeError are:
1) pip install django-pgcrypto==2.0.0
2) Profile.objects.get(pk=1).email
-> UnicodeDecodeError
3) pip install django-pgcrypto==1.4.0
4) Profile.objects.get(pk=1).email
-> No exception
@dcwatson Let me know if you need some extra details from me.
Sorry I haven't had a chance to try to reproduce this yet. Do you have any example data/keys from a previous version you can share here? The biggest holdup for me is I no longer have Python 2 installed.
I don't think this is related to the Python version. I have that issue on the Python 3.7 just by switching pgcrypto versions.
I just tried to re-create this and can't. I created a test model using 1.4 and saved some data, then updated to 2.0 and did not have trouble reading it. Are you dealing with international email addresses (i.e. is the data not ASCII) or is it possible it was originally saved with a different charset? How about your key - are you using bytes or a string? If using a string, it's encoded to bytes using charset
. If you can either synthesize or share some data that loads correctly with 1.4 and not 2.0, I could try to take a look.
I have an issue upgrading from the version
1.4.0
to2.0.0
I can't access the values of the fields stored in the DB with the version of the 1.4.0.Here is the model:
Here is how I try to access field value:
Traceback:
I have no issue accessing fields values saved with the
django-pgcrypto==2.0.0
.Here is the version of some related packages installed in that environment: