| 7 | |
| 8 | |
| 9 | def parse_combined_pem_file(pem_data: str) -> Tuple[Optional[str], Optional[str]]: |
| 10 | |
| 11 | # Extract the certificate |
| 12 | cert_start = "-----BEGIN CERTIFICATE-----" |
| 13 | cert_end = "-----END CERTIFICATE-----" |
| 14 | cert = None |
| 15 | if cert_start in pem_data and cert_end in pem_data: |
| 16 | cert = pem_data[pem_data.index(cert_start):pem_data.index(cert_end) + len(cert_end)] |
| 17 | |
| 18 | # Extract the private key |
| 19 | key_start = "-----BEGIN PRIVATE KEY-----" |
| 20 | key_end = "-----END PRIVATE KEY-----" |
| 21 | private_key = None |
| 22 | if key_start in pem_data and key_end in pem_data: |
| 23 | private_key = pem_data[pem_data.index(key_start):pem_data.index(key_end) + len(key_end)] |
| 24 | |
| 25 | return cert, private_key |
| 26 | |
| 27 | |
| 28 | def unwrap_ipv6(address): |