Revision ca8b1c21 snf-cyclades-app/synnefo/db/aes_encrypt.py
b/snf-cyclades-app/synnefo/db/aes_encrypt.py | ||
---|---|---|
2 | 2 |
from Crypto.Cipher import AES |
3 | 3 |
from random import choice |
4 | 4 |
from string import letters, digits |
5 |
from synnefo.settings import ENCRYPTION_KEY |
|
5 |
from synnefo.settings import SECRET_ENCRYPTION_KEY
|
|
6 | 6 |
|
7 | 7 |
|
8 | 8 |
DB_ENCRYPTED_FIELD_PREFIX = 'encrypted' |
... | ... | |
16 | 16 |
|
17 | 17 |
|
18 | 18 |
def encrypt(s): |
19 |
obj = AES.new(_pad_secret(ENCRYPTION_KEY), AES.MODE_CFB) |
|
19 |
obj = AES.new(_pad_secret(SECRET_ENCRYPTION_KEY), AES.MODE_CFB)
|
|
20 | 20 |
return obj.encrypt(s) |
21 | 21 |
|
22 | 22 |
|
23 | 23 |
def decrypt(s): |
24 |
obj = AES.new(_pad_secret(ENCRYPTION_KEY), AES.MODE_CFB) |
|
24 |
obj = AES.new(_pad_secret(SECRET_ENCRYPTION_KEY), AES.MODE_CFB)
|
|
25 | 25 |
return obj.decrypt(s) |
26 | 26 |
|
27 | 27 |
|
Also available in: Unified diff