fixed multiple bugs with cert operations

master 3.7.1.1
idziubenko 3 years ago
parent 15b0b7f9ed
commit 2fffe9d0e8

@ -235,8 +235,8 @@ def client_get_cert(cert_path, args):
OpenSSL.SSL.FILETYPE_PEM, ca_root)
issuer = certobj.get_issuer().get_components()
for item in issuer:
if item[0] == 'CN':
filename = item[1]
if item[0] == b'CN':
filename = item[1].decode("UTF-8")
fc = open(root_cert_md5, "a")
fc.write('%s %s\n' % (md5sum, filename))

@ -48,10 +48,10 @@ def verify(server_cert, crl_path, flag):
Issuer = certobj.get_issuer().get_components()
CN, L = None, None
for i in Issuer:
if i[0] == 'CN':
CN = i[1]
elif i[0] == 'L':
L = i[1]
if i[0] == b'CN':
CN = i[1].decode("UTF-8")
elif i[0] == b'L':
L = i[1].decode("UTF-8")
if CN and len(CN) > 2:
crl_file = crl_path + CN
@ -148,10 +148,10 @@ def get_CRL(path_to_cert):
Subject = certobj.get_subject().get_components()
subj = None
for subj in Subject:
if subj[0] == 'L':
url = "https://" + subj[1] + "/?wsdl"
if subj[0] == 'CN':
CN = subj[1]
if subj[0] == b'L':
url = "https://" + subj[1].decode("UTF-8") + "/?wsdl"
if subj[0] == b'CN':
CN = subj[1].decode("UTF-8")
if subj and url:
from .client_class import Client_suds, HTTPSClientCertTransport
@ -198,8 +198,8 @@ def find_ca_in_crl(CRL_path, all_ca_certs_list):
Issuer = certobj.get_issuer().get_components()
for item in Issuer:
if item[0] == 'CN':
CN = item[1]
if item[0] == b'CN':
CN = item[1].decode("UTF-8")
break
else:
continue
@ -214,7 +214,9 @@ def find_ca_in_crl(CRL_path, all_ca_certs_list):
try:
crl_object = OpenSSL.crypto.load_crl(OpenSSL.crypto.FILETYPE_PEM,
crl)
except OpenSSL.SSL.Error:
except OpenSSL.SSL.Error as e:
#debug
print(e)
continue
revoked_objects = crl_object.get_revoked()

@ -161,8 +161,8 @@ class clientHTTPSConnection(HTTPSConnection):
OpenSSL.SSL.FILETYPE_PEM, cert)
Issuer = certobj.get_issuer().get_components()
for item in Issuer:
if item[0] == 'CN':
filename = item[1]
if item[0] == b'CN':
filename = item[1].decode("UTF-8")
fc = open(root_cert_md5, "a")
fc.write('%s %s\n' % (md5sum, filename))

@ -367,8 +367,8 @@ class Basic(Service):
OpenSSL.SSL.FILETYPE_PEM, cert)
subject = cert_obj.get_subject().get_components()
for subj in subject:
if subj[0] == 'CN':
return subj[1]
if subj[0] == b'CN':
return subj[1].decode("UTF-8")
return b'No server host name provided'
@rpc(_returns=String)

@ -403,8 +403,8 @@ def get_certificate(cert_path, data_path, certbase, client_cert_path,
OpenSSL.SSL.FILETYPE_PEM, ca_root)
issuer = certobj.get_issuer().get_components()
for item in issuer:
if item[0] == 'CN':
filename = item[1]
if item[0] == b'CN':
filename = item[1].decode("UTF-8")
fc = open(root_cert_md5, "a")
fc.write('%s %s\n' % (md5sum, filename))

@ -45,7 +45,7 @@ _('No module named %s')
def main(*args, **keywords):
_args = list(unpack_single_opts(sys.argv[1:]))
caller = os.path.basename(sys.argv[0])
if not (caller == 'cl-core' or caller == "run_debug_core.py"):
if not (caller == 'cl-core' or caller == 'cl-core_py3' or caller == "run_debug_core.py"):
parser = cert_cmd.parse(full=False)
args, unknown_args = parser.parse_known_args(_args)
args.method = '_temp_'

@ -188,7 +188,7 @@ def local_method(metaObject, args, unknown_args):
sym_link = os.path.basename(sys.argv[0])
#debug
if not (sym_link == 'cl-core' or sym_link == "run_debug_core.py"):
if not (sym_link == 'cl-core' or sym_link == 'cl-core_py3' or sym_link == "run_debug_core.py"):
if sym_link in LoadedMethods.conMethods.keys():
args.method = LoadedMethods.conMethods[sym_link][0]
else:

@ -65,7 +65,7 @@ def get_ca(cert_path):
Issuer = certobj.get_issuer().get_components()
issuer_CN = None
for item in Issuer:
if item[0] == 'CN':
if item[0] == b'CN':
issuer_CN = item[1]
if issuer_CN is None:
@ -78,6 +78,6 @@ def get_ca(cert_path):
Subject = certobj.get_subject().get_components()
for subj in Subject:
if subj[0] == 'CN' and subj[1] == issuer_CN:
if subj[0] == b'CN' and subj[1] == issuer_CN:
return ca
return '2'

Loading…
Cancel
Save