- return "[ OU: %s, CN: %s, SubjectAltName: %s ]" % (getattr(x, "OU"), getattr(x, "CN"), self.get_data())
+ ou = getattr(x, "OU")
+ if ou:
+ message += " OU: {}".format(ou)
+ cn = getattr(x, "CN")
+ if cn:
+ message += " CN: {}".format(cn)
+ data = self.get_data(field='subjectAltName')
+ if data:
+ message += " SubjectAltName:"
+ counter = 0
+ filtered = [self.filter_chunk(chunk) for chunk in data.split()]
+ message += " ".join([f for f in filtered if f])
+ omitted = len([f for f in filtered if not f])
+ if omitted:
+ message += "..+{} omitted".format(omitted)
+ message += "]"
+ return message
+
+ def pretty_chain(self):
+ message = "{}".format(self.x509.get_subject())
+ parent = self.parent
+ while parent:
+ message += "->{}".format(parent.x509.get_subject())
+ parent = parent.parent
+ return message
+
+ def pretty_name(self):
+ return self.get_filename() or self.pretty_chain()