From d70454b32a6d265f78466ae8c94730e9460d3a32 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Thu, 23 Apr 2026 14:41:51 +0200 Subject: [PATCH] lib.ProcFilterGpg: Add module Add a ProcFilter implementation for decrypting GPG blobs. It needs an ExecContext passed to __init__() in order to run /usr/bin/gpg. Signed-off-by: Jan Lindemann --- src/python/jw/pkg/lib/ProcFilterGpg.py | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/python/jw/pkg/lib/ProcFilterGpg.py diff --git a/src/python/jw/pkg/lib/ProcFilterGpg.py b/src/python/jw/pkg/lib/ProcFilterGpg.py new file mode 100644 index 00000000..813c1fef --- /dev/null +++ b/src/python/jw/pkg/lib/ProcFilterGpg.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +from __future__ import annotations +from typing import TYPE_CHECKING + +from .ProcFilter import ProcFilter +from .base import Result + +if TYPE_CHECKING: + from .ExecContext import ExecContext + +class ProcFilterGpg(ProcFilter): + + def __init__(self, ec: ExecContext) -> None: + self.__ec = ec + + async def _run(self, data: bytes) -> Result: + return await self.__ec.run([ + "gpg", + '--batch', + '--yes', + '--quiet', + '--no-tty', + '--decrypt', + ], + cmd_input = data, + throw = True + )