aboutsummaryrefslogtreecommitdiffstats
path: root/python/test_gpg.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/test_gpg.py')
-rw-r--r--python/test_gpg.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/python/test_gpg.py b/python/test_gpg.py
new file mode 100644
index 00000000..2b346559
--- /dev/null
+++ b/python/test_gpg.py
@@ -0,0 +1,15 @@
+import gpg
+from serenitas.utils.exchange import ExchangeMessage
+
+
+em = ExchangeMessage()
+for msg in em.get_msgs(path=["SeleneOps", "Passport"]):
+ for attach in msg.attachments:
+ if attach.name == "Attachment1.pgp":
+ try:
+ with attach.fp as fp:
+ plaintext, result, verify_result = gpg.Context().decrypt(
+ fp.read(), passphrase="Serenitas1"
+ )
+ except gpg.errors.GPGMEError as e:
+ print(e)