def _loadCAsFromDir(directoryPath):
 caCerts = {}
 for child in directoryPath.children():
  if (not (child.asTextMode().basename().split(u'.')[(-1)].lower() == u'pem')):
   continue
  try:
   data = child.getContent()
  except IOError:
   continue
  try:
   theCert = Certificate.loadPEM(data)
  except SSLError:
   pass
  else:
   caCerts[theCert.digest()] = theCert
 return trustRootFromCertificates(caCerts.values())

def _loadCAsFromDir ( directoryPath ) : caCerts = { } for child in directoryPath . children ( ) : if ( not ( child . asTextMode ( ) . basename ( ) . split ( u'.' ) [ ( - 1 ) ] . lower ( ) == u'pem' ) ) : continue try : data = child . getContent ( ) except IOError : continue try : theCert = Certificate . loadPEM ( data ) except SSLError : pass else : caCerts [ theCert . digest ( ) ] = theCert return trustRootFromCertificates ( caCerts . values ( ) )
load certificate-authority certificate objects in a given directory .