Obtain subject alternative names from the Python cryptography extensions object.
(self, cert_object, extensions)
| 537 | cert_object["signature_algorithm"] = "" |
| 538 | |
| 539 | def __get_alternative_names(self, cert_object, extensions): |
| 540 | """ |
| 541 | Obtain subject alternative names from the Python cryptography extensions object. |
| 542 | """ |
| 543 | cert_object["subject_dns_names"] = [] |
| 544 | cert_object["subject_ip_addresses"] = [] |
| 545 | try: |
| 546 | alt_names = extensions.get_extension_for_oid( |
| 547 | ExtensionOID.SUBJECT_ALTERNATIVE_NAME |
| 548 | ) |
| 549 | new_names = alt_names.value.get_values_for_type(x509.DNSName) |
| 550 | cert_object["subject_dns_names"] = new_names |
| 551 | new_ips = alt_names.value.get_values_for_type(x509.IPAddress) |
| 552 | for ip in new_ips: |
| 553 | cert_object["subject_ip_addresses"].append(str(ip)) |
| 554 | except ExtensionNotFound: |
| 555 | self._logger.debug("No alternative names") |
| 556 | |
| 557 | def __get_key_usages(self, cert_object, extensions): |
| 558 | """ |