Commit 3ff69dc4 authored by Yingjie Xu's avatar Yingjie Xu

Generic select function.

Fetch all trustable entries and let client decide which entries to use.
parent d3aec190
...@@ -299,6 +299,25 @@ class NetworkcacheClient(object): ...@@ -299,6 +299,25 @@ class NetworkcacheClient(object):
traceback.format_exc())) traceback.format_exc()))
return self.download(sha512) return self.download(sha512)
def select_generic(self, key):
''' Select trustable entries from shadir.
'''
url = os.path.join(self.shadir_url, key)
request = urllib2.Request(url=url, data=None,
headers=self.shadir_header_dict)
data = urllib2.urlopen(request).read()
try:
data_list = json.loads(data)
except Exception:
raise DirectoryNotFound('It was impossible to parse json response:\n%s' %
traceback.format_exc())
filtered_data_list = []
for data in data_list:
if len(data[1]):
if self._verifySignatureInCertificateList(data[0], data[1]):
filtered_data_list.append(data)
return filtered_data_list
def _getSignatureString(self, content): def _getSignatureString(self, content):
""" """
Return the signature based on certification file. Return the signature based on certification file.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment