8 Functions for processing public keys, common to multiple commands.
12 SigningKey, get_verification_key, \
13 export_verification_key, \
14 create_key_evidence, export_signature
15 from typing
import Optional
16 from os.path
import exists
21 public_key_file: Optional[str],
22 evidence_file: Optional[str]) ->
None:
24 Print (and optionally save) public information about a private key.
27 if public_key_file
and exists(public_key_file):
28 raise Exception(
"public key file already exists")
29 if evidence_file
and exists(evidence_file):
30 raise Exception(
"evidence file already exists")
38 with open(public_key_file,
"w")
as pk_f:
39 pk_f.write(pub_key_str)
41 with open(evidence_file,
"w")
as ev_f:
42 ev_f.write(evidence_str)
44 print(
"Public Verification Key:")
46 print(
"\nKey Evidence:")