moved to src directory plus new features
This commit is contained in:
parent
a658ff7ba8
commit
b091bad77d
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,4 +1,6 @@
|
|||||||
.venv
|
.venv
|
||||||
__pycache__
|
__pycache__
|
||||||
gen
|
gen
|
||||||
original
|
original
|
||||||
|
out
|
||||||
|
*pb2.py
|
3
Makefile
3
Makefile
@ -4,4 +4,5 @@ setup-venv:
|
|||||||
setup-python:
|
setup-python:
|
||||||
mkdir -p gen/python
|
mkdir -p gen/python
|
||||||
protoc --python_out=gen/python crs.proto
|
protoc --python_out=gen/python crs.proto
|
||||||
exit
|
cp gen/python/crs_pb2.py src/root_store_gen
|
||||||
|
exit
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
import sys
|
|
||||||
import os.path as path
|
|
||||||
import pathlib
|
|
||||||
import importlib.util
|
|
||||||
import sys
|
|
||||||
import crs_pb2
|
|
||||||
def usage():
|
|
||||||
print("Usage: <proto input> <proto output>")
|
|
||||||
cwd = path.dirname(path.abspath(sys.argv[0]))
|
|
||||||
if len(sys.argv) < 2:
|
|
||||||
usage()
|
|
||||||
exit(-1)
|
|
||||||
buf= open(sys.argv[1], 'rb')
|
|
||||||
rs = crs_pb2.RootStore()
|
|
||||||
rs.ParseFromString(buf.read())
|
|
||||||
print(rs.trust_anchors[0])
|
|
34
src/root_store_gen/generate_new_pbs.py
Normal file
34
src/root_store_gen/generate_new_pbs.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import sys
|
||||||
|
import os.path as path
|
||||||
|
import pathlib
|
||||||
|
import importlib.util
|
||||||
|
import sys
|
||||||
|
import crs_pb2
|
||||||
|
def usage():
|
||||||
|
print("Usage: <proto input> <new ca key>... <proto output>")
|
||||||
|
cwd = path.dirname(path.abspath(sys.argv[0]))
|
||||||
|
if len(sys.argv) < 4:
|
||||||
|
usage()
|
||||||
|
exit(-1)
|
||||||
|
cas = []
|
||||||
|
for a in sys.argv[2:-1:]:
|
||||||
|
print(f"Registering CA from {a}")
|
||||||
|
cas.append(a)
|
||||||
|
outfile = sys.argv[-1]
|
||||||
|
print(f"Outputing to: {outfile}")
|
||||||
|
out = open(outfile, 'wb')
|
||||||
|
buf= open(sys.argv[1], 'rb')
|
||||||
|
rs = crs_pb2.RootStore()
|
||||||
|
rs.ParseFromString(buf.read())
|
||||||
|
for ca in cas:
|
||||||
|
with open(ca, 'rb') as file:
|
||||||
|
print(f"Loading Certificate Authority {ca} into rootstore")
|
||||||
|
der = file.read()
|
||||||
|
next_trust_anchor = crs_pb2.TrustAnchor()
|
||||||
|
next_trust_anchor.Clear()
|
||||||
|
next_trust_anchor.der = der
|
||||||
|
next_trust_anchor.display_name = "Success!"
|
||||||
|
print(next_trust_anchor.constraints)
|
||||||
|
rs.trust_anchors.append(next_trust_anchor)
|
||||||
|
out.write(rs.SerializeToString())
|
||||||
|
out.close()
|
9
src/root_store_gen/print_pb.py
Normal file
9
src/root_store_gen/print_pb.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import crs_pb2
|
||||||
|
import sys
|
||||||
|
if (len(sys.argv) < 2):
|
||||||
|
print("Usage: <chrome root store protobuf file>")
|
||||||
|
exit(-1)
|
||||||
|
rs = crs_pb2.RootStore()
|
||||||
|
with open(sys.argv[1], 'rb') as f:
|
||||||
|
rs.ParseFromString(f.read())
|
||||||
|
print(rs)
|
Loading…
x
Reference in New Issue
Block a user