args' corresponding functions spec'd out and found (and have workaround for) racetime condition in Vault.

This commit is contained in:
bts
2020-04-05 03:26:52 -04:00
parent a3b370cc6e
commit 439e86d8c3
7 changed files with 228 additions and 35 deletions
+10 -1
View File
@@ -18,8 +18,17 @@ class GPG(object):
def decrypt(self, fpath):
fpath = os.path.abspath(os.path.expanduser(fpath))
_logger.debug('Opening {0} for decryption'.format(fpath))
with open(fpath, 'rb') as fh:
iobuf = io.BytesIO(fh.read())
data = fh.read()
decrypted = self.decryptData(data)
return(decrypted)
def decryptData(self, data):
if isinstance(data, str):
data = data.encode('utf-8')
_logger.debug('Decrypting {0} bytes'.format(len(data)))
iobuf = io.BytesIO(data)
iobuf.seek(0, 0)
rslt = self.gpg.decrypt(iobuf)
decrypted = rslt[0]