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

AES issues on Python 3 #18

Closed
jayfk opened this issue Dec 15, 2015 · 2 comments
Closed

AES issues on Python 3 #18

jayfk opened this issue Dec 15, 2015 · 2 comments

Comments

@jayfk
Copy link

jayfk commented Dec 15, 2015

I'm unable to create a migration using AES.

Blowfish seems to work:

date_hired = pgcrypto.EncryptedTextField(cipher='Blowfish', key='datekey')

But AES does'nt:

date_hired = pgcrypto.EncryptedTextField(cipher='AES', key='datekey')

Traceback


Traceback (most recent call last):
  File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.5/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
utility.execute()
  File "/usr/local/lib/python3.5/site-packages/django/core/management/__init__.py", line 342, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.5/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.5/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
  File "/usr/local/lib/python3.5/site-packages/django/core/management/commands/makemigrations.py", line 106, in handle
ProjectState.from_apps(apps),
  File "/usr/local/lib/python3.5/site-packages/django/db/migrations/state.py", line 174, in from_apps
model_state = ModelState.from_model(model)
  File "/usr/local/lib/python3.5/site-packages/django/db/migrations/state.py", line 393, in from_model
fields.append((name, field.clone()))
  File "/usr/local/lib/python3.5/site-packages/django/db/models/fields/__init__.py", line 464, in clone
return self.__class__(*args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/pgcrypto/fields.py", line 24, in __init__
self.cipher_key = aes_pad_key(self.cipher_key.encode(self.charset))
AttributeError: 'bytes' object has no attribute 'encode'
@jayfk
Copy link
Author

jayfk commented Dec 21, 2015

Works when installing directly from github. The PyPi release seems to be a bit dated. Any chance for a new release?

@dcwatson
Copy link
Owner

dcwatson commented Mar 2, 2016

Pushed out 1.3.0 to PyPI

@dcwatson dcwatson closed this as completed Mar 2, 2016
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