Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Luciano Barletta
/
message-service
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
1
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 5fe66ea1
authored
2019-09-24 13:20:42 +0000
by
Luciano Barletta
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Fixed encryption mode
1 parent
6f4ef1a5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
deploy.py
deploy.py
View file @
5fe66ea
...
...
@@ -30,8 +30,8 @@ def data():
prefix
=
newprefix
()
key
=
request
.
files
.
get
(
'key'
)
if
key
!=
None
:
key
.
save
(
prefix
+
"_key"
)
request
.
files
[
'data'
]
.
save
(
prefix
)
key
.
save
(
prefix
+
"_key
.enc
"
)
request
.
files
[
'data'
]
.
save
(
prefix
+
".enc"
)
filename
[
prefix
]
=
request
.
files
[
'data'
]
.
filename
return
prefix
...
...
@@ -54,16 +54,18 @@ def msg():
process
=
Process
(
'messages.db'
)
prefix
=
request
.
values
[
'id'
]
if
not
os
.
path
.
exists
(
prefix
)
:
if
prefix
not
in
filename
:
return
"El id de la data es invalido"
# symetric key was sent, decrypt data
if
os
.
path
.
exists
(
prefix
+
"_key"
):
if
os
.
path
.
exists
(
prefix
+
"_key
.enc
"
):
# decrypt random key with stored private key and store in host folder
os
.
system
(
"openssl rsautl -decrypt -inkey rsa_key.pri -in "
+
prefix
+
"_key -out "
+
prefix
+
"_key"
)
os
.
system
(
"openssl rsautl -decrypt -inkey rsa_key.pri -in "
+
prefix
+
"_key
.enc
-out "
+
prefix
+
"_key"
)
# decrypt JSON with decrypted random key and store in dir folder
os
.
system
(
"openssl enc -d -aes-256-cbc -in "
+
prefix
+
" -out "
+
prefix
+
" -pass file:"
+
prefix
+
"_key"
)
# delete key
os
.
system
(
"openssl enc -d -aes-256-cbc -in "
+
prefix
+
".enc -out "
+
prefix
+
" -pass file:"
+
prefix
+
"_key"
)
# delete garbage
os
.
system
(
"rm "
+
prefix
+
".enc"
)
os
.
system
(
"rm "
+
prefix
+
"_key.enc"
)
os
.
system
(
"rm "
+
prefix
+
"_key"
)
query
=
{
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment