aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/oids.py
blob: 7d790dc9fe34a04542edb39c6829e46eb89ff17b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python3
import glob
import json
import sys
import os.path
import requests

if __name__ == "__main__":
    result = 0
    for curves_json in glob.glob("*/curves.json"):
        category = os.path.dirname(curves_json)
        with open(curves_json) as f:
            curves = json.load(f)
        for curve in curves["curves"]:
            if "oid" not in curve:
                continue
            oid = curve["oid"]
            if not oid:
                print(f"Curve {category}/{curve['name']} has empty OID value.")
                continue
            url = f"http://oid-info.com/get/{oid}"
            r = requests.get(url, timeout=5)
            if r.status_code != 200:
                print(f"Curve {category}/{curve['name']} has bad OID, return code {r.status_code}!")
                result = 1
    sys.exit(result)