def make_ssl_devcert(base_path, host=None, cn=None):
 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, 'wb') as f:
  f.write(crypto.dump_certificate(crypto.FILETYPE_PEM, cert))
 with open(pkey_file, 'wb') as f:
  f.write(crypto.dump_privatekey(crypto.FILETYPE_PEM, pkey))
 return (cert_file, pkey_file)

def make_ssl_devcert ( base_path , host = None , cn = None ) : 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 , 'wb' ) as f : f . write ( crypto . dump_certificate ( crypto . FILETYPE_PEM , cert ) ) with open ( pkey_file , 'wb' ) as f : f . write ( crypto . dump_privatekey ( crypto . FILETYPE_PEM , pkey ) ) return ( cert_file , pkey_file )
creates an ssl key for development .