Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
re2o
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nounous
re2o
Commits
6d335881
Commit
6d335881
authored
Jan 27, 2018
by
Hugo LEVY-FALK
Committed by
root
Jan 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Meilleure gestion du AESField
parent
f0168825
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
4 deletions
+1
-4
preferences/aes_field.py
preferences/aes_field.py
+1
-4
No files found.
preferences/aes_field.py
View file @
6d335881
...
...
@@ -27,6 +27,7 @@ def encrypt(key, s):
def
decrypt
(
key
,
s
):
obj
=
AES
.
new
(
key
)
ss
=
obj
.
decrypt
(
s
)
print
(
ss
)
return
ss
.
split
(
bytes
(
EOD
,
'utf-8'
))[
0
]
...
...
@@ -35,10 +36,6 @@ class AESEncryptedField(models.CharField):
setattr
(
instance
,
self
.
name
,
binascii
.
b2a_base64
(
encrypt
(
settings
.
AES_KEY
,
data
)))
def
value_from_object
(
self
,
obj
):
return
decrypt
(
settings
.
AES_KEY
,
binascii
.
a2b_base64
(
getattr
(
obj
,
self
.
attname
))).
decode
(
'utf-8'
)
def
to_python
(
self
,
value
):
if
value
is
None
:
return
None
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment