Also find a possible parent, and add it to the end of the list
This commit is contained in:
parent
5c4f6d2c67
commit
5cce5722c5
@ -252,9 +252,14 @@ def order_x509(x509_objects, root_issuers):
|
|||||||
while x509_objects:
|
while x509_objects:
|
||||||
sibling = [x for x in x509_objects
|
sibling = [x for x in x509_objects
|
||||||
if x.get_issuer() == bundle[0].get_subject()]
|
if x.get_issuer() == bundle[0].get_subject()]
|
||||||
|
parent = [x for x in x509_objects
|
||||||
|
if x.get_subject() == bundle[-1].get_issuer()]
|
||||||
if sibling and len(sibling) == 1:
|
if sibling and len(sibling) == 1:
|
||||||
# insert sibling at beginning of list
|
# insert sibling at beginning of list
|
||||||
bundle.insert(0, x509_objects.pop(x509_objects.index(sibling[0])))
|
bundle.insert(0, x509_objects.pop(x509_objects.index(sibling[0])))
|
||||||
|
elif parent and len(parent) == 1:
|
||||||
|
# Try to place a (cross signed) intermediate at the end if it matches
|
||||||
|
bundle.append(x509_objects.pop(x509_objects.index(parent[0])))
|
||||||
else:
|
else:
|
||||||
# Lets complain
|
# Lets complain
|
||||||
logging.error('Certificates remaining data\n\t%s',
|
logging.error('Certificates remaining data\n\t%s',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user