-
Notifications
You must be signed in to change notification settings - Fork 0
/
scratchpad.py
26 lines (21 loc) · 878 Bytes
/
scratchpad.py
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
import os
import shutil
from tempfile import TemporaryDirectory
import time
from gpyg import GPG, StatusInteractive, ProcessSession
if os.path.exists("./tmp"):
shutil.rmtree("./tmp")
os.makedirs("./tmp", exist_ok=True)
with TemporaryDirectory(dir="tmp", delete=False) as tmpdir:
gpg = GPG(homedir=tmpdir, kill_existing_agent=True)
key = gpg.keys.generate_key("Test Key", passphrase="beans")
print(key.revoke(passphrase="beans"))
print(gpg.keys.list_keys())
"""gpg = GPG(homedir=tmpdir, kill_existing_agent=True)
key = gpg.keys.generate_key("Bongus", passphrase="test")
key_other = gpg.keys.generate_key("Bingus", passphrase="test")
print("BONGUS:", key.fingerprint)
print("BINGUS:", key_other.fingerprint)
with key.edit(passphrase="test", run_as=key_other.fingerprint) as editor:
print(editor.sign())
key.reload()"""