def _parseClientSSLOptions(kwargs):
 hostname = kwargs.pop('hostname', None)
 clientCertificate = _privateCertFromPaths(kwargs.pop('certKey', None), kwargs.pop('privateKey', None))
 trustRoot = _parseTrustRootPath(kwargs.pop('caCertsDir', None))
 if (hostname is not None):
  configuration = optionsForClientTLS(_idnaText(hostname), trustRoot=trustRoot, clientCertificate=clientCertificate)
 else:
  if (clientCertificate is not None):
   privateKeyOpenSSL = clientCertificate.privateKey.original
   certificateOpenSSL = clientCertificate.original
  else:
   privateKeyOpenSSL = None
   certificateOpenSSL = None
  configuration = CertificateOptions(trustRoot=trustRoot, privateKey=privateKeyOpenSSL, certificate=certificateOpenSSL)
 kwargs['sslContextFactory'] = configuration
 return kwargs

def _parseClientSSLOptions ( kwargs ) : hostname = kwargs . pop ( 'hostname' , None ) clientCertificate = _privateCertFromPaths ( kwargs . pop ( 'certKey' , None ) , kwargs . pop ( 'privateKey' , None ) ) trustRoot = _parseTrustRootPath ( kwargs . pop ( 'caCertsDir' , None ) ) if ( hostname is not None ) : configuration = optionsForClientTLS ( _idnaText ( hostname ) , trustRoot = trustRoot , clientCertificate = clientCertificate ) else : if ( clientCertificate is not None ) : privateKeyOpenSSL = clientCertificate . privateKey . original certificateOpenSSL = clientCertificate . original else : privateKeyOpenSSL = None certificateOpenSSL = None configuration = CertificateOptions ( trustRoot = trustRoot , privateKey = privateKeyOpenSSL , certificate = certificateOpenSSL ) kwargs [ 'sslContextFactory' ] = configuration return kwargs
parse common arguments for ssl endpoints .