MCPcopy Create free account
hub / github.com/ceph/ceph / parse_combined_pem_file

Function parse_combined_pem_file

src/python-common/ceph/deployment/utils.py:9–25  ·  view source on GitHub ↗
(pem_data: str)

Source from the content-addressed store, hash-verified

7
8
9def 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
28def unwrap_ipv6(address):

Callers 1

validateMethod · 0.90

Calls 1

indexMethod · 0.45

Tested by

no test coverage detected