Django: searching on an EncryptedCharField (django-extensions), is this possible? -


is possible?

for model encryptedcharfield named "first_name" notice field not decrypt when search on it. in other uses fine. not work:

if form.is_valid():     cd = form.cleaned_data     search_results = mytable.objects.filter(first_name__icontains=cd['search_term']) 

is design or doing wrong? help...

encrypting search term first, if exact decrypted value, not work cipher not going same 1 stored in db. not work:

crypter = crypter.read(settings.encrypted_field_keys_dir) if form.is_valid():     cd = form.cleaned_data     cipher = crypter.encrypt(cd['search_term'])     search_results = mytable.objects.filter(first_name__icontains=cipher) 

when encrypted (or @ least, when done properly), impossible gain value has been encrypted, without knowing value. means while can check value of password quickly, user has given value of password, hard find out value of password encrypted string. part of p=np topic.

when search via mytable.objects.filter(first_name=cipher), comparing encrypted strings, fine. however, when try mytable.objects.filter(first_name_icontains=cipher), asking django unencrypt of values, compare them, return matches. however, django cannot that, no 1 knows value of decrypted first_name field is. design, means if database compromised, data safe (it why should beware website or organisation show password, means have not encrypted value in database). overall, not being able see users password thing, , if not agree, small price pay security.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -