Pārlūkot izejas kodu

def gpg_decrypt(path, verify=False)

Fabian Peter Hammerle 5 gadi atpakaļ
vecāks
revīzija
06623516fd
1 mainītis faili ar 7 papildinājumiem un 0 dzēšanām
  1. 7 0
      rc.xsh

+ 7 - 0
rc.xsh

@@ -189,6 +189,13 @@ def dpkg_which(cmd):
     assert len(matches) == 1
     return matches[0]
 
+def gpg_decrypt(path, verify=False):
+    import gpg
+    with gpg.Context() as gpg_ctx:
+        with open(path, 'rb') as f:
+            data, decrypt_result, verify_result = gpg_ctx.decrypt(f, verify=verify)
+    return data
+
 def locate(*patterns, match_all=True, ignore_case=True):
     params = []
     if match_all: