X-Git-Url: https://pwan.org/git/?p=certmaster.git;a=blobdiff_plain;f=certmaster%2FSSLCommon.py;h=e93ff639fa8a0a58c5b01e7bf0d6c834ed00ee09;hp=6959749508dc6f0fa527eeaebfc55ed89bca2919;hb=c6eb51dbc3be8ef1b97ad66ac5f218d5d48c9ec0;hpb=62dcbd84977206450edf4c6e6739371ae6dadadb diff --git a/certmaster/SSLCommon.py b/certmaster/SSLCommon.py index 6959749..e93ff63 100644 --- a/certmaster/SSLCommon.py +++ b/certmaster/SSLCommon.py @@ -29,13 +29,16 @@ def our_verify(connection, x509, errNum, errDepth, preverifyOK): return preverifyOK -def CreateSSLContext(pkey, cert, ca_cert): +def CreateSSLContext(pkey, cert, ca_cert, passwd_callback=None): for f in pkey, cert, ca_cert: if f and not os.access(f, os.R_OK): print "%s does not exist or is not readable." % f os._exit(1) ctx = SSL.Context(SSL.SSLv3_METHOD) # SSLv3 only + if passwd_callback: + ctx.set_passwd_cb = passwd_callback + ctx.use_certificate_file(cert) ctx.use_privatekey_file(pkey) ctx.load_client_ca(ca_cert)