File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -66,15 +66,14 @@ class SecurityTool(object):
6666 """
6767 Security tool : secret key generator and encode, encrypt, hash tools
6868 """
69- __fernet_key = Fernet .generate_key ()
70- __cipher_suite = Fernet (__fernet_key )
7169
72- #def __init__(self):
73- # Fernet : symmetric encryption
74- # Fernet.generate_key : Generates a fresh fernet key. This must be kept secret. Keep this some place safe!
75- # If you lose it you’ll no longer be able to decrypt messages;
76- # Anyone with this key is able to create and read messages.
70+ __cipher_suite = Fernet (app .config ['FERNET_SECRET_KEY' ])
7771
72+ # def __init__(self):
73+ # Fernet : symmetric encryption
74+ # FERNET SECRET KEY for encryption : This must be kept secret. Keep this some place safe!
75+ # If you lose it you’ll no longer be able to decrypt messages and anyone with this key is able to create and read messages.
76+ # __cipher_suite = Fernet(app.config['FERNET_SECRET_KEY'])
7877 # override to prevent peeking
7978 # self.__dict__ = {}
8079
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ class BaseConfig(object):
3636 # secret key used also for csrf_token
3737 SECRET_KEY = 'write-a-secret-string-here-or-in-the-instance-secret-folder'
3838
39+ # Fernet key for encryption must be 32 url-safe base64-encoded bytes
40+ FERNET_SECRET_KEY = 'write-a-secret-string-here-or-in-the-instance-secret-folder'
3941
4042 LISTINGS_PER_PAGE = 5
4143
You can’t perform that action at this time.
0 commit comments