

def make_ssl_devcert(base_path, host=None, cn=None):
    "Creates an SSL key for development.  This should be used instead of\n    the ``'adhoc'`` key which generates a new cert on each server start.\n    It accepts a path for where it should store the key and cert and\n    either a host or CN.  If a host is given it will use the CN\n    ``*.host/CN=host``.\n\n    For more information see :func:`run_simple`.\n\n    .. versionadded:: 0.9\n\n    :param base_path: the path to the certificate and key.  The extension\n                      ``.crt`` is added for the certificate, ``.key`` is\n                      added for the key.\n    :param host: the name of the host.  This can be used as an alternative\n                 for the `cn`.\n    :param cn: the `CN` to use.\n    "
    from OpenSSL import crypto
    if (host is not None):
        cn = ('*.%s/CN=%s' % (host, host))
    (cert, pkey) = generate_adhoc_ssl_pair(cn=cn)
    cert_file = (base_path + '.crt')
    pkey_file = (base_path + '.key')
    with open(cert_file, 'w') as f:
        f.write(crypto.dump_certificate(crypto.FILETYPE_PEM, cert))
    with open(pkey_file, 'w') as f:
        f.write(crypto.dump_privatekey(crypto.FILETYPE_PEM, pkey))
    return (cert_file, pkey_file)

dataset/ETHPy150Open Eforcers/gae-flask-todo/lib/werkzeug/serving.py make_ssl_devcert/original