py2 -> py3
This commit is contained in:
parent
66c9ecd6cf
commit
54c3f9acaa
|
@ -1395,15 +1395,15 @@ class Connection(CommonConnection, ConnectionHandlers):
|
|||
text += _('\nSSL Error: <b>%s</b>') % ssl_error[errnum]
|
||||
else:
|
||||
text += _('\nUnknown SSL error: %d') % errnum
|
||||
fingerprint = cert.digest('sha1')
|
||||
fingerprint = cert.digest('sha1').decode('utf-8')
|
||||
pem = OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_PEM,
|
||||
cert)
|
||||
cert).decode('utf-8')
|
||||
gajim.nec.push_incoming_event(SSLErrorEvent(None, conn=self,
|
||||
error_text=text, error_num=errnum, cert=pem,
|
||||
fingerprint=fingerprint, certificate=cert))
|
||||
return True
|
||||
if cert:
|
||||
fingerprint = cert.digest('sha1')
|
||||
fingerprint = cert.digest('sha1').decode('utf-8')
|
||||
saved_fingerprint = gajim.config.get_per('accounts', self.name,
|
||||
'ssl_fingerprint_sha1')
|
||||
if saved_fingerprint:
|
||||
|
@ -1420,7 +1420,7 @@ class Connection(CommonConnection, ConnectionHandlers):
|
|||
'100' not in gajim.config.get_per('accounts', self.name,
|
||||
'ignore_ssl_errors').split():
|
||||
pem = OpenSSL.crypto.dump_certificate(
|
||||
OpenSSL.crypto.FILETYPE_PEM, cert)
|
||||
OpenSSL.crypto.FILETYPE_PEM, cert).decode('utf-8')
|
||||
txt = _('The authenticity of the %s certificate could be '
|
||||
'invalid.\nThe certificate does not cover this domain.') %\
|
||||
hostname
|
||||
|
|
|
@ -1639,8 +1639,8 @@ class NewAccountConnectedEvent(nec.NetworkIncomingEvent):
|
|||
if self.conn.connection.Connection.ssl_certificate:
|
||||
cert = self.conn.connection.Connection.ssl_certificate
|
||||
self.ssl_cert = OpenSSL.crypto.dump_certificate(
|
||||
OpenSSL.crypto.FILETYPE_PEM, cert)
|
||||
self.ssl_fingerprint = cert.digest('sha1')
|
||||
OpenSSL.crypto.FILETYPE_PEM, cert).decode('utf-8')
|
||||
self.ssl_fingerprint = cert.digest('sha1').decode('utf-8')
|
||||
return True
|
||||
|
||||
class NewAccountNotConnectedEvent(nec.NetworkIncomingEvent):
|
||||
|
|
|
@ -289,7 +289,8 @@ def make_certs(filepath, CN):
|
|||
os.chmod(filepath + '.pkey', 0600)
|
||||
f.write(crypto.dump_privatekey(crypto.FILETYPE_PEM, key))
|
||||
with open(filepath + '.cert', 'wb') as f:
|
||||
f.write(crypto.dump_certificate(crypto.FILETYPE_PEM, cert))
|
||||
f.write(crypto.dump_certificate(crypto.FILETYPE_PEM, cert).decode(
|
||||
'utf-8'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -71,10 +71,10 @@ except ImportError:
|
|||
try:
|
||||
from distutils.version import LooseVersion as V
|
||||
if V(nbxmpp.__version__) < V("0.3"):
|
||||
print 'Gajim needs python-nbxmpp > 0.3 to run. Quiting...'
|
||||
print('Gajim needs python-nbxmpp > 0.3 to run. Quiting...')
|
||||
sys.exit()
|
||||
except:
|
||||
print 'Gajim needs python-nbxmpp > 0.3 to run. Quiting...'
|
||||
print('Gajim needs python-nbxmpp > 0.3 to run. Quiting...')
|
||||
sys.exit()
|
||||
|
||||
#from common import demandimport
|
||||
|
|
Loading…
Reference in New Issue