Is there any documentation or examples/tutorial how to get EncryptedCharField working in a Django model?
It took me allot of time to install django-extension + keyczar etc in my django project. There is no doc how to get it installed.
This is what got so far:
pip install django-extensions
added 'django_extensions' to INSTALLED_APPS
pip install python-keyczar
created a model + added field with EncryptedCharField
added ENCRYPTED_FIELD_KEYS_DIR = '../../../enc-keys'
downloaded KeyczarTool-0.71g-090613.jar
ran the following command: java -jar KeyczarTool-0.71g-090613.jar create --location=./enc-keys --purpose=crypt --name="first key" --asymmetric=rsa
So far so good, but when I run my server I get the following error:
keyczar.errors.KeyNotFoundError: Key with hash_val identifier None not found.
TRACEBACK
File "/Users/nv/Projects/project/models/client.py", line 78, in <module>
class Authorization(models.Model):
File "/Users/nv/Projects/project/models/client.py", line 86, in Authorization
iban_enc = EncryptedCharField(max_length=155)
File "/Users/nv/Projects/project/lib/python2.7/site-packages/django_extensions/db/fields/encrypted.py", line 121, in __init__
super(EncryptedCharField, self).__init__(*args, **kwargs)
File "/Users/nv/Projects/project/lib/python2.7/site-packages/django_extensions/db/fields/encrypted.py", line 32, in __init__
max_length = len(self.prefix) + len(self.crypt.Encrypt('x' * max_length))
File "/Users/nv/Projects/project/lib/python2.7/site-packages/keyczar/keyczar.py", line 338, in Encrypt
encrypting_key = self.primary_key
File "/Users/nv/Projects/project/lib/python2.7/site-packages/keyczar/keyczar.py", line 73, in <lambda>
primary_key = property(lambda self: self.GetKey(self.primary_version),
File "/Users/nv/Projects/project/lib/python2.7/site-packages/keyczar/keyczar.py", line 128, in GetKey
raise errors.KeyNotFoundError(key_id)
keyczar.errors.KeyNotFoundError: Key with hash_val identifier None not found.
I can't figure out what I'm doing wrong.
FOUND THE SOLUTION
After create: