def _loadCAsFromDir(directoryPath):
    from twisted.internet import ssl

    caCerts = {}
    for child in directoryPath.children():
        if not child.basename().split('.')[-1].lower() == 'pem':
            continue
        try:
            data = child.getContent()
        except IOError:
            # Permission denied, corrupt disk, we don't care.
            continue
        try:
            theCert = ssl.Certificate.loadPEM(data)
        except ssl.SSL.Error:
            # Duplicate certificate, invalid certificate, etc.  We don't care.
            pass
        else:
            caCerts[theCert.digest()] = theCert.original
    return caCerts.values()
Load certificate-authority certificate objects in a given directory.
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/internet/endpoints.py/_loadCAsFromDir