ssl.DER_cert_to_PEM_cert
Prev: ssl.DefaultVerifyPaths | Up: ssl | Next: ssl.get_default_verify_paths
Rel: ssl.AlertDescription, ssl.cert_time_to_seconds, ssl.CertificateError, ssl.create_connection
Ref: docs.python.org — ssl.DER_cert_to_PEM_cert
Tags: #public #python3 #stdlib #ssl
Import
import ssl
from ssl import DER_cert_to_PEM_cert
Signature & Overview
ssl.DER_cert_to_PEM_cert(der_cert_bytes)
Takes a certificate in binary DER format and returns the PEM version of it as a string.
Usage
import ssl
pem = ssl.DER_cert_to_PEM_cert(b"\x30\x00")
assert pem.startswith("-----BEGIN CERTIFICATE-----")
assert ssl.PEM_cert_to_DER_cert(pem) == b"\x30\x00"
Gotchas
- Pure Base64 + PEM header framing: Does not validate that the DER bytes form a valid X.509 certificate.
REPL Inspect
from ssl import DER_cert_to_PEM_cert
help(DER_cert_to_PEM_cert)
Linked from
Related notes
- tuts/python3/stdlib_module/ssl/DefaultVerifyPaths Linked here; links to this page; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/get_default_verify_paths Linked here; links to this page; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/ssl/AlertDescription Linked here; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/cert_time_to_seconds Linked here; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/CertificateError Linked here; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/create_connection Linked here; shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/create_default_context shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/get_protocol_name shared tags: #ssl, #stdlib
- tuts/python3/stdlib_module/ssl/get_server_certificate shared tags: #ssl, #stdlib