Py3 compatibilty of CryptConnection module
This commit is contained in:
parent
65d19d350c
commit
6df0321962
1 changed files with 5 additions and 6 deletions
|
@ -5,7 +5,6 @@ import ssl
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
from Config import config
|
from Config import config
|
||||||
from util import SslPatch
|
|
||||||
from util import helper
|
from util import helper
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,13 +71,13 @@ class CryptConnectionManager:
|
||||||
import subprocess
|
import subprocess
|
||||||
cmd = "%s req -x509 -newkey rsa:2048 -sha256 -batch -keyout %s -out %s -nodes -config %s" % helper.shellquote(
|
cmd = "%s req -x509 -newkey rsa:2048 -sha256 -batch -keyout %s -out %s -nodes -config %s" % helper.shellquote(
|
||||||
self.openssl_bin,
|
self.openssl_bin,
|
||||||
config.data_dir+"/key-rsa.pem",
|
config.data_dir + "/key-rsa.pem",
|
||||||
config.data_dir+"/cert-rsa.pem",
|
config.data_dir + "/cert-rsa.pem",
|
||||||
self.openssl_env["OPENSSL_CONF"]
|
self.openssl_env["OPENSSL_CONF"]
|
||||||
)
|
)
|
||||||
proc = subprocess.Popen(
|
proc = subprocess.Popen(
|
||||||
cmd.encode(sys.getfilesystemencoding()),
|
cmd, shell=True, stderr=subprocess.STDOUT,
|
||||||
shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, env=self.openssl_env
|
stdout=subprocess.PIPE, env=self.openssl_env
|
||||||
)
|
)
|
||||||
back = proc.stdout.read().strip()
|
back = proc.stdout.read().strip()
|
||||||
proc.wait()
|
proc.wait()
|
||||||
|
@ -87,7 +86,7 @@ class CryptConnectionManager:
|
||||||
if os.path.isfile("%s/cert-rsa.pem" % config.data_dir) and os.path.isfile("%s/key-rsa.pem" % config.data_dir):
|
if os.path.isfile("%s/cert-rsa.pem" % config.data_dir) and os.path.isfile("%s/key-rsa.pem" % config.data_dir):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
logging.error("RSA ECC SSL cert generation failed, cert or key files not exist.")
|
logging.error("RSA SSL cert generation failed, cert or key files not exist.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Not used yet: Missing on some platform
|
# Not used yet: Missing on some platform
|
||||||
|
|
Loading…
Reference in a new issue