-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecode_keys.py
More file actions
29 lines (22 loc) · 847 Bytes
/
decode_keys.py
File metadata and controls
29 lines (22 loc) · 847 Bytes
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
27
28
29
import sys
from exposure_keys.keys_pb2 import TEKSignatureList, TemporaryExposureKeyExport
def decode_key_from_file(file_name: str) -> TemporaryExposureKeyExport:
with open(file_name, mode="rb") as f:
content = f.read()
content = content.strip(b"EK Export v1 ")
export = TemporaryExposureKeyExport()
export.ParseFromString(content)
return export
def decode_signature_from_file(file_name: str) -> TEKSignatureList:
with open(file_name, mode="rb") as f:
content = f.read()
signature = TEKSignatureList()
signature.ParseFromString(content)
return signature
if __name__ == "__main__":
"""
Usage:
python ./decode_keys.py /1591142400-00001/
"""
print(decode_key_from_file(sys.argv[1] + "export.bin"))
print(decode_signature_from_file(sys.argv[1] + "export.sig"))