Commit 5ed93f4c authored by Yingjie Xu's avatar Yingjie Xu

Forces to use trustable certificate.

parent 2a9024fc
...@@ -220,22 +220,17 @@ class NetworkcacheClient(object): ...@@ -220,22 +220,17 @@ class NetworkcacheClient(object):
raise DirectoryNotFound('It was impossible to parse json response:\n%s'% raise DirectoryNotFound('It was impossible to parse json response:\n%s'%
traceback.format_exc()) traceback.format_exc())
filtered_data_list = [] filtered_data_list = []
if self.signature_certificate_list is not None: if self.signature_certificate_list is None:
for data in data_list: raise DirectoryNotFound('No trustable certificate is configured.')
if len(data[1]): for data in data_list:
if self._verifySignatureInCertificateList(data[0], data[1]) and \ if len(data[1]):
self._isCompatible(data[0], binary_mode=binary_mode): if self._verifySignatureInCertificateList(data[0], data[1]) and \
filtered_data_list.append(data) self._isCompatible(data[0], binary_mode=binary_mode):
else: filtered_data_list.append(data)
filtered_data_list = data_list
if len(filtered_data_list) == 0: if len(filtered_data_list) == 0:
raise DirectoryNotFound('Could not find a trustable entry.') raise DirectoryNotFound('Could not find a trustable entry.')
if len(filtered_data_list) > 1 and self.signature_certificate_list is None:
raise DirectoryNotFound('Too many entries for a given key %r. ' \
'Entries: %s.' % (key, str(data_list)))
information_json, signature = filtered_data_list[0] information_json, signature = filtered_data_list[0]
try: try:
information_dict = json.loads(information_json) information_dict = json.loads(information_json)
......
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