forked from Disroot/gpg-lacre
Use pysequoia for decryption
This commit is contained in:
parent
9d47de4979
commit
eef301c863
|
@ -197,8 +197,11 @@ class GPGDecryptor:
|
||||||
def decrypt(self):
|
def decrypt(self):
|
||||||
"""Decrypt the message."""
|
"""Decrypt the message."""
|
||||||
p = subprocess.Popen(self._command(), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen(self._command(), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
decdata = p.communicate(input=self._message)[0]
|
try:
|
||||||
return (decdata, p.returncode)
|
decrypted = pysequoia.decrypt(bytes = self._message)
|
||||||
|
return (decrypted.bytes.decode("utf8"), 0)
|
||||||
|
except:
|
||||||
|
return ("", 1)
|
||||||
|
|
||||||
def _command(self):
|
def _command(self):
|
||||||
return _build_command(self._keyhome, "--trust-model", "always", "--batch", "--yes", "--no-secmem-warning", "-a", "-d")
|
return _build_command(self._keyhome, "--trust-model", "always", "--batch", "--yes", "--no-secmem-warning", "-a", "-d")
|
||||||
|
|
Loading…
Reference in New Issue