def _parseClientSSL(**kwargs):
 from twisted.internet import ssl
 kwargs = _parseClientTCP(**kwargs)
 certKey = kwargs.pop('certKey', None)
 privateKey = kwargs.pop('privateKey', None)
 caCertsDir = kwargs.pop('caCertsDir', None)
 if (certKey is not None):
  certx509 = ssl.Certificate.loadPEM(FilePath(certKey).getContent()).original
 else:
  certx509 = None
 if (privateKey is not None):
  privateKey = ssl.PrivateCertificate.loadPEM(FilePath(privateKey).getContent()).privateKey.original
 else:
  privateKey = None
 if (caCertsDir is not None):
  verify = True
  caCerts = _loadCAsFromDir(FilePath(caCertsDir))
 else:
  verify = False
  caCerts = None
 kwargs['sslContextFactory'] = ssl.CertificateOptions(method=ssl.SSL.SSLv23_METHOD, certificate=certx509, privateKey=privateKey, verify=verify, caCerts=caCerts)
 return kwargs

def _parseClientSSL ( ** kwargs ) : from twisted . internet import ssl kwargs = _parseClientTCP ( ** kwargs ) certKey = kwargs . pop ( 'certKey' , None ) privateKey = kwargs . pop ( 'privateKey' , None ) caCertsDir = kwargs . pop ( 'caCertsDir' , None ) if ( certKey is not None ) : certx509 = ssl . Certificate . loadPEM ( FilePath ( certKey ) . getContent ( ) ) . original else : certx509 = None if ( privateKey is not None ) : privateKey = ssl . PrivateCertificate . loadPEM ( FilePath ( privateKey ) . getContent ( ) ) . privateKey . original else : privateKey = None if ( caCertsDir is not None ) : verify = True caCerts = _loadCAsFromDir ( FilePath ( caCertsDir ) ) else : verify = False caCerts = None kwargs [ 'sslContextFactory' ] = ssl . CertificateOptions ( method = ssl . SSL . SSLv23_METHOD , certificate = certx509 , privateKey = privateKey , verify = verify , caCerts = caCerts ) return kwargs
perform any argument value coercion necessary for ssl client parameters .