def load_certificates(directory='.'):
 certs = {}
 if (not os.path.isdir(directory)):
  raise IOError('Invalid certificate directory: {0}'.format(directory))
 glob_string = os.path.join(directory, '*.key')
 cert_files = glob.glob(glob_string)
 for cert_file in cert_files:
  (public_key, _) = load_certificate(cert_file)
  if public_key:
   certs[public_key] = True
 return certs

def load_certificates ( directory = '.' ) : certs = { } if ( not os . path . isdir ( directory ) ) : raise IOError ( 'Invalid certificate directory: {0}' . format ( directory ) ) glob_string = os . path . join ( directory , '*.key' ) cert_files = glob . glob ( glob_string ) for cert_file in cert_files : ( public_key , _ ) = load_certificate ( cert_file ) if public_key : certs [ public_key ] = True return certs
load public keys from all certificates in a directory .