Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I hash/encrypt or otherwise protect emails in my Django app from hackers?

Hoping for a simple function I can use to store emails securely and retrieve easily when required to send emails.

like image 952
user2916527 Avatar asked Dec 17 '13 23:12

user2916527


People also ask

How do I encrypt my Django app?

To encrypt your data using django_cryptography, all you need to do is import encrypt from django_cryptography. fields and use it directly on each field where it is required. In app/models.py put the code given below. Then, add the code given below to app/admin.py to display your models on your admin page.

Should you encrypt all emails?

When encrypting emails, it's important to encrypt all of them, not just the ones with sensitive information. If only some of your emails are encrypted, it is a red flag for a hacker and could make your inbox even less secure.

What are the two main methods used to encrypt email?

Email encryption works with asymmetric and symmetric keys with both methods offering similar security level but operating in different ways. Asymmetric encryption involves a public encryption key anyone can use to encrypt a message and then a private encryption key with which to decrypt the message.

Can encrypted emails be intercepted?

Not even the sender has access to this private key, making it completely unfeasible for an outside party to intercept and read the contents of the email. With end-to-end encryption, third party interception becomes impossible — no matter where it may be on its path to its intended recipient.


1 Answers

Kind of a general question, but here are a few solutions I'm familiar with:

  • use django-encrypted-fields, which has an EncryptedEmailField
  • you can override the save method for encrypting the email yourself, then override the post_init signal for decryption. See example here (which is based on this)
  • you can build your own encrypted email field, see django snippet here (uses pyCrypto)
  • you can use django-extension's EncryptedCharField
  • If none of the above seems good enough, try google-ing around by yourself. You're probably not the first to tackle this problem

good luck.

like image 182
yuvi Avatar answered Oct 25 '22 02:10

yuvi