summaryrefslogtreecommitdiff
path: root/monitor/josef_lib.py
diff options
context:
space:
mode:
Diffstat (limited to 'monitor/josef_lib.py')
-rw-r--r--monitor/josef_lib.py37
1 files changed, 31 insertions, 6 deletions
diff --git a/monitor/josef_lib.py b/monitor/josef_lib.py
index b2643c1..2d24bce 100644
--- a/monitor/josef_lib.py
+++ b/monitor/josef_lib.py
@@ -22,6 +22,31 @@ from Crypto.Hash import SHA256
import Crypto.PublicKey.RSA as RSA
from Crypto.Signature import PKCS1_v1_5
+def compare_lists(new, old):
+ added_items = []
+ removed_items = []
+
+ for item in new:
+ if not item in old:
+ added_items.append(item)
+
+ for item in old:
+ if not item in new:
+ removed_items.append(item)
+ return added_items, removed_items
+
+def get_all_roots(base_url):
+ result = urlopen(base_url + "ct/v1/get-roots").read()
+ certs = json.loads(result)["certificates"]
+ # print time.strftime('%H:%M:%S') + " Received " + str(len(certs)) + " certs from " + base_url
+
+ for accepted_cert in certs:
+ subject = get_cert_info(base64.decodestring(accepted_cert))["subject"]
+ issuer = get_cert_info(base64.decodestring(accepted_cert))["issuer"]
+ if subject == issuer:
+ root_cert = base64.decodestring(accepted_cert)
+ return certs
+
def check_domain_all(raw_entry, log=None):
orig_entry = extract_original_entry(raw_entry)
try:
@@ -277,9 +302,9 @@ def add_chain(baseurl, submission):
return json.loads(result)
except urllib2.HTTPError, e:
print "ERROR", e.code,":", e.read()
- if e.code == 400:
- return None
- sys.exit(1)
+ # if e.code == 400:
+ return None
+ # sys.exit(1)
except ValueError, e:
print "==== FAILED REQUEST ===="
print submission
@@ -295,9 +320,9 @@ def add_prechain(baseurl, submission):
return json.loads(result)
except urllib2.HTTPError, e:
print "ERROR", e.code,":", e.read()
- if e.code == 400:
- return None
- sys.exit(1)
+ # if e.code == 400:
+ return None
+ # sys.exit(1)
except ValueError, e:
print "==== FAILED REQUEST ===="
print submission