[Git][gajim/gajim][master] Dump certificate before writing it to storage
Philipp Hörist
gitlab at dev.gajim.org
Mon Jul 9 20:15:20 CEST 2018
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
eb1b6f60 by Philipp Hörist at 2018-07-09T20:15:13+02:00
Dump certificate before writing it to storage
- - - - -
1 changed file:
- gajim/gui_interface.py
Changes:
=====================================
gajim/gui_interface.py
=====================================
--- a/gajim/gui_interface.py
+++ b/gajim/gui_interface.py
@@ -47,6 +47,8 @@ from gi.repository import GLib
from gi.repository import Gio
from gi.repository import Gdk
+import OpenSSL
+
try:
from PIL import Image
except:
@@ -1324,20 +1326,24 @@ class Interface:
def on_ok(is_checked):
del self.instances[account]['online_dialog']['ssl_error']
if is_checked[0]:
+
+ pem = OpenSSL.crypto.dump_certificate(
+ OpenSSL.crypto.FILETYPE_PEM, obj.cert).decode('utf-8')
+
# Check if cert is already in file
certs = ''
my_ca_certs = configpaths.get('MY_CACERTS')
if os.path.isfile(my_ca_certs):
with open(my_ca_certs, encoding='utf-8') as f:
certs = f.read()
- if obj.cert in certs:
+ if pem in certs:
dialogs.ErrorDialog(_('Certificate Already in File'),
_('This certificate is already in file %s, so it\'s '
'not added again.') % my_ca_certs)
else:
with open(my_ca_certs, 'a', encoding='utf-8') as f:
f.write(server + '\n')
- f.write(obj.cert + '\n\n')
+ f.write(pem + '\n\n')
if is_checked[1]:
ignore_ssl_errors = app.config.get_per('accounts', account,
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/eb1b6f605a0d7422bb1e12e8258f63d9aef2bff6
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/eb1b6f605a0d7422bb1e12e8258f63d9aef2bff6
You're receiving this email because of your account on dev.gajim.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gajim.org/pipermail/commits/attachments/20180709/f8f857d2/attachment-0001.html>
More information about the Commits
mailing list