Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gajim-plugins
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Evert Mouw
gajim-plugins
Commits
aa880116
Commit
aa880116
authored
8 years ago
by
Philipp Hörist
Browse files
Options
Downloads
Patches
Plain Diff
Add encrypted file upload for windows
parent
5c510c10
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
httpupload/httpupload.py
+21
-14
21 additions, 14 deletions
httpupload/httpupload.py
httpupload/manifest.ini
+1
-1
1 addition, 1 deletion
httpupload/manifest.ini
with
22 additions
and
15 deletions
httpupload/httpupload.py
+
21
−
14
View file @
aa880116
...
...
@@ -35,9 +35,8 @@ try:
except
:
pil_available
=
False
from
io
import
BytesIO
import
base64
import
binascii
import
binascii
from
common
import
gajim
from
common
import
ged
import
chat_control
...
...
@@ -49,19 +48,21 @@ import nbxmpp
log
=
logging
.
getLogger
(
'
gajim.plugin_system.httpupload
'
)
if
os
.
name
!=
'
nt
'
:
try
:
try
:
if
os
.
name
==
'
nt
'
:
from
cryptography.hazmat.backends.openssl
import
backend
else
:
from
cryptography.hazmat.backends
import
default_backend
from
cryptography.hazmat.primitives.ciphers
import
Cipher
from
cryptography.hazmat.primitives.ciphers
import
algorithms
from
cryptography.hazmat.primitives.ciphers.modes
import
GCM
encryption_available
=
True
except
Exception
as
e
:
log
.
debug
(
e
)
encryption_available
=
False
else
:
from
cryptography.hazmat.primitives.ciphers
import
Cipher
from
cryptography.hazmat.primitives.ciphers
import
algorithms
from
cryptography.hazmat.primitives.ciphers.modes
import
GCM
encryption_available
=
True
except
Exception
as
e
:
DEP_MSG
=
'
For encryption of files,
'
\
'
please install python-cryptography!
'
log
.
debug
(
'
Cryptography Import Error:
'
+
str
(
e
))
log
.
info
(
'
Decryption/Encryption disabled due to errors
'
)
encryption_available
=
False
log
.
info
(
'
Cryptography not available on Windows for now
'
)
# XEP-0363 (http://xmpp.org/extensions/xep-0363.html)
NS_HTTPUPLOAD
=
'
urn:xmpp:http:upload
'
...
...
@@ -78,6 +79,8 @@ class HttpuploadPlugin(GajimPlugin):
@log_calls
(
'
HttpuploadPlugin
'
)
def
init
(
self
):
if
not
encryption_available
:
self
.
available_text
=
DEP_MSG
self
.
config_dialog
=
None
# HttpuploadPluginConfigDialog(self)
self
.
controls
=
[]
self
.
events_handlers
=
{}
...
...
@@ -571,10 +574,14 @@ class StreamFileWithProgress(file):
self
.
encrypted_upload
=
encrypted_upload
self
.
seek
(
0
,
os
.
SEEK_END
)
if
self
.
encrypted_upload
:
if
os
.
name
==
'
nt
'
:
self
.
backend
=
backend
else
:
self
.
backend
=
default_backend
()
self
.
encryptor
=
Cipher
(
algorithms
.
AES
(
key
),
GCM
(
iv
),
backend
=
default_
backend
()
).
encryptor
()
backend
=
self
.
backend
).
encryptor
()
self
.
_total
=
self
.
tell
()
+
TAGSIZE
else
:
self
.
_total
=
self
.
tell
()
...
...
This diff is collapsed.
Click to expand it.
httpupload/manifest.ini
+
1
−
1
View file @
aa880116
[info]
name:
HttpUpload
short_name:
httpupload
version:
0.4.
0
version:
0.4.
1
description:
This
plugin
is
designed
to
send
a
file
to
a
contact
or
muc
by
using
httpupload.<br/>
Your
server
must
support
<a
href
=
"http://xmpp.org/extensions/xep-0363.html">XEP-0363: HTTP Upload</a>.<br/>
Conversations
supported
this.<br/>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment