diff options
Diffstat (limited to 'cpp/config/convertssl.py')
-rwxr-xr-x | cpp/config/convertssl.py | 184 |
1 files changed, 92 insertions, 92 deletions
diff --git a/cpp/config/convertssl.py b/cpp/config/convertssl.py index 348023bb26f..8950ccd1685 100755 --- a/cpp/config/convertssl.py +++ b/cpp/config/convertssl.py @@ -52,8 +52,8 @@ else: def findChild(parent, name): for i in parent.childNodes: - if i.localName == name: - return i + if i.localName == name: + return i return None def printConfig(node, name, comment=""): @@ -62,98 +62,98 @@ def printConfig(node, name, comment=""): result = result + "#\n# NOTE: You may need to define IceSSL.DefaultDir\n" general = findChild(node, "general") if general: - if general.attributes.has_key("version"): - version = general.attributes["version"].nodeValue - if version == "SSLv3": - result = result + prefix + "Protocols=SSLv3\n" - elif version == "TLSv1": - result = result + prefix + "Protocols=TLSv1\n" - elif version != "SSLv23": - print "unknown value `" + version + "' for version attribute" - sys.exit(1) - - if general.attributes.has_key("cipherlist"): - result = result + prefix + "Ciphers=" + general.attributes["cipherlist"].nodeValue + "\n" - - if general.attributes.has_key("verifymode"): - verifymode = general.attributes["verifymode"].nodeValue - if verifymode == "none": - result = result + prefix + "VerifyPeer=0\n" - elif verifymode == "peer": - result = result + prefix + "VerifyPeer=1\n" - elif verifymode.find("fail") != -1: - result = result + prefix + "VerifyPeer=2\n" - elif verifymode.find("client_once") != -1: - result = result + prefix + "VerifyPeer=2\n" - else: - print "unknown value `" + verifymode + "' for verifymode attribute" - sys.exit(1) - - if general.attributes.has_key("verifydepth"): - result = result + prefix + "VerifyDepthMax=" + general.attributes["verifydepth"].nodeValue + "\n" - - if general.attributes.has_key("randombytes"): - result = result + "# NOTE: You may need to use IceSSL.EntropyDaemon\n" - result = result + prefix + "Random=" + general.attributes["randombytes"].nodeValue + "\n" + if general.attributes.has_key("version"): + version = general.attributes["version"].nodeValue + if version == "SSLv3": + result = result + prefix + "Protocols=SSLv3\n" + elif version == "TLSv1": + result = result + prefix + "Protocols=TLSv1\n" + elif version != "SSLv23": + print "unknown value `" + version + "' for version attribute" + sys.exit(1) + + if general.attributes.has_key("cipherlist"): + result = result + prefix + "Ciphers=" + general.attributes["cipherlist"].nodeValue + "\n" + + if general.attributes.has_key("verifymode"): + verifymode = general.attributes["verifymode"].nodeValue + if verifymode == "none": + result = result + prefix + "VerifyPeer=0\n" + elif verifymode == "peer": + result = result + prefix + "VerifyPeer=1\n" + elif verifymode.find("fail") != -1: + result = result + prefix + "VerifyPeer=2\n" + elif verifymode.find("client_once") != -1: + result = result + prefix + "VerifyPeer=2\n" + else: + print "unknown value `" + verifymode + "' for verifymode attribute" + sys.exit(1) + + if general.attributes.has_key("verifydepth"): + result = result + prefix + "VerifyDepthMax=" + general.attributes["verifydepth"].nodeValue + "\n" + + if general.attributes.has_key("randombytes"): + result = result + "# NOTE: You may need to use IceSSL.EntropyDaemon\n" + result = result + prefix + "Random=" + general.attributes["randombytes"].nodeValue + "\n" ca = findChild(node, "certauthority") if ca: - if ca.attributes.has_key("file"): - result = result + prefix + "CertAuthFile=" + ca.attributes["file"].nodeValue + "\n" - if ca.attributes.has_key("path"): - result = result + prefix + "CertAuthDir=" + ca.attributes["path"].nodeValue + "\n" + if ca.attributes.has_key("file"): + result = result + prefix + "CertAuthFile=" + ca.attributes["file"].nodeValue + "\n" + if ca.attributes.has_key("path"): + result = result + prefix + "CertAuthDir=" + ca.attributes["path"].nodeValue + "\n" basecerts = findChild(node, "basecerts") if basecerts: - certFile = "" - keyFile = "" - rsacert = findChild(basecerts, "rsacert") - if rsacert: - pub = findChild(rsacert, "public") - if pub.attributes.has_key("encoding"): - if pub.attributes["encoding"].nodeValue != "PEM": - result = result + "# NOTE: Only PEM encoding is supported for certificates!\n" - if pub.attributes.has_key("filename"): - certFile = pub.attributes["filename"].nodeValue - priv = findChild(rsacert, "private") - if priv.attributes.has_key("encoding"): - if priv.attributes["encoding"].nodeValue != "PEM": - result = result + "# NOTE: Only PEM encoding is supported for private keys!\n" - if priv.attributes.has_key("filename"): - keyFile = priv.attributes["filename"].nodeValue - dsacert = findChild(basecerts, "dsacert") - if dsacert: - pub = findChild(dsacert, "public") - if pub.attributes.has_key("encoding"): - if pub.attributes["encoding"].nodeValue != "PEM": - result = result + "# NOTE: Only PEM encoding is supported for certificates!\n" - if pub.attributes.has_key("filename"): - if len(certFile) > 0: - certFile = certFile + sep + pub.attributes["filename"].nodeValue - else: - certFile = pub.attributes["filename"].nodeValue - priv = findChild(rsacert, "private") - if priv.attributes.has_key("encoding"): - if priv.attributes["encoding"].nodeValue != "PEM": - result = result + "# NOTE: Only PEM encoding is supported for private keys!\n" - if priv.attributes.has_key("filename"): - if len(keyFile) > 0: - keyFile = keyFile + sep + priv.attributes["filename"].nodeValue - else: - keyFile = priv.attributes["filename"].nodeValue - if len(certFile) > 0: - result = result + prefix + "CertFile=" + certFile + "\n" - if len(keyFile) > 0: - result = result + prefix + "KeyFile=" + keyFile + "\n" - - for child in basecerts.childNodes: - if child.localName == "dhparams": - keysize = child.attributes["keysize"].nodeValue - if child.attributes.has_key("encoding"): - if child.attributes["encoding"].nodeValue != "PEM": - result = result + "# NOTE: Only PEM encoding is supported for DH parameters!\n" - filename = child.attributes["filename"].nodeValue - result = result + prefix + "DH." + keysize + "=" + filename + "\n" + certFile = "" + keyFile = "" + rsacert = findChild(basecerts, "rsacert") + if rsacert: + pub = findChild(rsacert, "public") + if pub.attributes.has_key("encoding"): + if pub.attributes["encoding"].nodeValue != "PEM": + result = result + "# NOTE: Only PEM encoding is supported for certificates!\n" + if pub.attributes.has_key("filename"): + certFile = pub.attributes["filename"].nodeValue + priv = findChild(rsacert, "private") + if priv.attributes.has_key("encoding"): + if priv.attributes["encoding"].nodeValue != "PEM": + result = result + "# NOTE: Only PEM encoding is supported for private keys!\n" + if priv.attributes.has_key("filename"): + keyFile = priv.attributes["filename"].nodeValue + dsacert = findChild(basecerts, "dsacert") + if dsacert: + pub = findChild(dsacert, "public") + if pub.attributes.has_key("encoding"): + if pub.attributes["encoding"].nodeValue != "PEM": + result = result + "# NOTE: Only PEM encoding is supported for certificates!\n" + if pub.attributes.has_key("filename"): + if len(certFile) > 0: + certFile = certFile + sep + pub.attributes["filename"].nodeValue + else: + certFile = pub.attributes["filename"].nodeValue + priv = findChild(rsacert, "private") + if priv.attributes.has_key("encoding"): + if priv.attributes["encoding"].nodeValue != "PEM": + result = result + "# NOTE: Only PEM encoding is supported for private keys!\n" + if priv.attributes.has_key("filename"): + if len(keyFile) > 0: + keyFile = keyFile + sep + priv.attributes["filename"].nodeValue + else: + keyFile = priv.attributes["filename"].nodeValue + if len(certFile) > 0: + result = result + prefix + "CertFile=" + certFile + "\n" + if len(keyFile) > 0: + result = result + prefix + "KeyFile=" + keyFile + "\n" + + for child in basecerts.childNodes: + if child.localName == "dhparams": + keysize = child.attributes["keysize"].nodeValue + if child.attributes.has_key("encoding"): + if child.attributes["encoding"].nodeValue != "PEM": + result = result + "# NOTE: Only PEM encoding is supported for DH parameters!\n" + filename = child.attributes["filename"].nodeValue + result = result + prefix + "DH." + keysize + "=" + filename + "\n" return result @@ -171,10 +171,10 @@ for x in sys.argv[1:]: usage() sys.exit(1) else: - if xmlfile: - usage() - sys.exit(1) - xmlfile = x + if xmlfile: + usage() + sys.exit(1) + xmlfile = x if not xmlfile: usage() |