MCPcopy Index your code
hub / github.com/python/cpython / DER_cert_to_PEM_cert

Function DER_cert_to_PEM_cert

Lib/ssl.py:1534–1539  ·  view source on GitHub ↗

Takes a certificate in binary DER format and returns the PEM version of it as a string.

(der_cert_bytes)

Source from the content-addressed store, hash-verified

1532PEM_FOOTER = "-----END CERTIFICATE-----"
1533
1534def DER_cert_to_PEM_cert(der_cert_bytes):
1535 """Takes a certificate in binary DER format and returns the
1536 PEM version of it as a string."""
1537
1538 f = str(base64.b64encode(der_cert_bytes, wrapcol=64), 'ASCII')
1539 return f'{PEM_HEADER}\n{f}\n{PEM_FOOTER}\n'
1540
1541def PEM_cert_to_DER_cert(pem_cert_string):
1542 """Takes a certificate in ASCII PEM format and returns the

Callers 1

get_server_certificateFunction · 0.85

Calls 1

strFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…