Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | #!/usr/bin/python |
michael@0 | 2 | |
michael@0 | 3 | import tempfile, os, sys |
michael@0 | 4 | |
michael@0 | 5 | libpath = os.path.abspath('../psm_common_py') |
michael@0 | 6 | sys.path.append(libpath) |
michael@0 | 7 | import CertUtils |
michael@0 | 8 | |
michael@0 | 9 | srcdir = os.getcwd() |
michael@0 | 10 | db = tempfile.mkdtemp() |
michael@0 | 11 | |
michael@0 | 12 | def generate_ca_cert(db_dir, dest_dir, noise_file, name): |
michael@0 | 13 | return CertUtils.generate_ca_cert(db_dir, dest_dir, noise_file, name, |
michael@0 | 14 | 3, True) |
michael@0 | 15 | |
michael@0 | 16 | def generate_child_cert(db_dir, dest_dir, noise_file, name, ca_nick, is_ee, |
michael@0 | 17 | ocsp_url): |
michael@0 | 18 | return CertUtils.generate_child_cert(db_dir, dest_dir, noise_file, name, |
michael@0 | 19 | ca_nick, 3, True, is_ee, ocsp_url) |
michael@0 | 20 | |
michael@0 | 21 | def generate_certs(): |
michael@0 | 22 | [noise_file, pwd_file] = CertUtils.init_nss_db(srcdir) |
michael@0 | 23 | generate_ca_cert(srcdir, srcdir, noise_file, 'ca') |
michael@0 | 24 | generate_child_cert(srcdir, srcdir, noise_file, 'int', 'ca', False, '') |
michael@0 | 25 | nick_baseurl = { 'no-path-url': "http://www.example.com:8888", |
michael@0 | 26 | 'ftp-url': "ftp://www.example.com:8888/", |
michael@0 | 27 | 'no-scheme-url': "www.example.com:8888/", |
michael@0 | 28 | 'empty-scheme-url': "://www.example.com:8888/", |
michael@0 | 29 | 'no-host-url': "http://:8888/", |
michael@0 | 30 | 'hTTp-url': "hTTp://www.example.com:8888/hTTp-url", |
michael@0 | 31 | 'https-url': "https://www.example.com:8888/https-url", |
michael@0 | 32 | 'bad-scheme': "/www.example.com", |
michael@0 | 33 | 'empty-port': "http://www.example.com:/", |
michael@0 | 34 | 'unknown-scheme': "ttp://www.example.com", |
michael@0 | 35 | 'negative-port': "http://www.example.com:-1", |
michael@0 | 36 | 'no-scheme-host-port': "/" } |
michael@0 | 37 | for nick, url in nick_baseurl.iteritems(): |
michael@0 | 38 | generate_child_cert(srcdir, srcdir, noise_file, nick, 'int', True, url) |
michael@0 | 39 | |
michael@0 | 40 | generate_certs() |