moved to src directory plus new features

This commit is contained in:
MunyDev 2024-08-09 01:55:16 -04:00
parent a658ff7ba8
commit b091bad77d
No known key found for this signature in database
GPG Key ID: 7DFBB51356064F62
6 changed files with 48 additions and 18 deletions

4
.gitignore vendored

@ -1,4 +1,6 @@
.venv
__pycache__
gen
original
original
out
*pb2.py

@ -4,4 +4,5 @@ setup-venv:
setup-python:
mkdir -p gen/python
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])

BIN
myCA.der Normal file

Binary file not shown.

@ -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()

@ -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)