Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vmj-qt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
vmj-qt
Commits
5cbc764b
Commit
5cbc764b
authored
Sep 15, 2022
by
Tijmen de Mes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored encrypt message
parent
5d99a16f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
6 deletions
+3
-6
message.py
blink/streams/message.py
+3
-6
No files found.
blink/streams/message.py
View file @
5cbc764b
...
@@ -151,17 +151,14 @@ class MessageStream(object, metaclass=MediaStreamType):
...
@@ -151,17 +151,14 @@ class MessageStream(object, metaclass=MediaStreamType):
def
enable_pgp
(
self
):
def
enable_pgp
(
self
):
self
.
_load_pgp_keys
()
self
.
_load_pgp_keys
()
def
encrypt
(
self
,
content
):
def
encrypt
(
self
,
content
,
content_type
=
None
):
session
=
self
.
blink_session
# print('-- Encrypting message')
# print('-- Encrypting message')
stream
=
session
.
fake_streams
.
get
(
'messages'
)
pgp_message
=
PGPMessage
.
new
(
content
,
compression
=
CompressionAlgorithm
.
Uncompressed
)
pgp_message
=
PGPMessage
.
new
(
content
,
compression
=
CompressionAlgorithm
.
Uncompressed
)
cipher
=
SymmetricKeyAlgorithm
.
AES256
cipher
=
SymmetricKeyAlgorithm
.
AES256
sessionkey
=
cipher
.
gen_key
()
sessionkey
=
cipher
.
gen_key
()
encrypted_content
=
s
tream
.
public_key
.
encrypt
(
pgp_message
,
cipher
=
cipher
,
sessionkey
=
sessionkey
)
encrypted_content
=
s
elf
.
public_key
.
encrypt
(
pgp_message
,
cipher
=
cipher
,
sessionkey
=
sessionkey
)
encrypted_content
=
s
tream
.
remote_public_key
.
encrypt
(
encrypted_content
,
cipher
=
cipher
,
sessionkey
=
sessionkey
)
encrypted_content
=
s
elf
.
remote_public_key
.
encrypt
(
encrypted_content
,
cipher
=
cipher
,
sessionkey
=
sessionkey
)
del
sessionkey
del
sessionkey
return
str
(
encrypted_content
)
return
str
(
encrypted_content
)
...
...
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