def pem_to_der(pem_str):
    """Convert a PEM string to DER format"""
    lines = pem_str.strip().splitlines()
    der = binascii.a2b_base64("".join(lines[1:-1]))
    return der
Convert a PEM string to DER format
app/certsynth.py