security/manager/ssl/tests/unit/test_ocsp_url/generate.py

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rwxr-xr-x

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 #!/usr/bin/python
     3 import tempfile, os, sys
     5 libpath = os.path.abspath('../psm_common_py')
     6 sys.path.append(libpath)
     7 import CertUtils
     9 srcdir = os.getcwd()
    10 db = tempfile.mkdtemp()
    12 def generate_ca_cert(db_dir, dest_dir, noise_file, name):
    13     return CertUtils.generate_ca_cert(db_dir, dest_dir, noise_file, name,
    14                                       3, True)
    16 def generate_child_cert(db_dir, dest_dir, noise_file, name, ca_nick, is_ee,
    17                         ocsp_url):
    18     return CertUtils.generate_child_cert(db_dir, dest_dir, noise_file, name,
    19                                          ca_nick, 3, True, is_ee, ocsp_url)
    21 def generate_certs():
    22     [noise_file, pwd_file] = CertUtils.init_nss_db(srcdir)
    23     generate_ca_cert(srcdir, srcdir, noise_file, 'ca')
    24     generate_child_cert(srcdir, srcdir, noise_file, 'int', 'ca', False, '')
    25     nick_baseurl = { 'no-path-url': "http://www.example.com:8888",
    26                      'ftp-url': "ftp://www.example.com:8888/",
    27                      'no-scheme-url': "www.example.com:8888/",
    28                      'empty-scheme-url': "://www.example.com:8888/",
    29                      'no-host-url': "http://:8888/",
    30                      'hTTp-url': "hTTp://www.example.com:8888/hTTp-url",
    31                      'https-url': "https://www.example.com:8888/https-url",
    32                      'bad-scheme': "/www.example.com",
    33                      'empty-port': "http://www.example.com:/",
    34                      'unknown-scheme': "ttp://www.example.com",
    35                      'negative-port': "http://www.example.com:-1",
    36                      'no-scheme-host-port': "/" }
    37     for nick, url in nick_baseurl.iteritems():
    38         generate_child_cert(srcdir, srcdir, noise_file, nick, 'int', True, url)
    40 generate_certs()

mercurial