fix in decryption, changed its test to have consistent result (thanks /dev/zero)
This commit is contained in:
parent
75ac6cd045
commit
3cb86f17f2
|
@ -39,10 +39,15 @@ def decryptFile(args):
|
|||
# sys.exit(1)
|
||||
|
||||
#Decrypt file
|
||||
print(args.metadata)
|
||||
# print(args.metadata)
|
||||
metadata = json.loads(args.metadata)
|
||||
|
||||
content = symmetric_encryption.decrypt_file(metadata['key'].encode(), BASE_DIR + args.encrypted)
|
||||
print(BASE_DIR + args.encrypted)
|
||||
|
||||
content = symmetric_encryption.decrypt_file(bytes.fromhex(metadata['key']), BASE_DIR + args.encrypted)
|
||||
|
||||
with open(BASE_DIR + 'decryped_file.txt', 'w') as f:
|
||||
f.write(content)
|
||||
|
||||
# Send decrypted content to stdout
|
||||
sys.stdout.write(content)
|
||||
|
|
|
@ -85,7 +85,7 @@ def test_rep_activate_subject():
|
|||
|
||||
def test_rep_add_doc():
|
||||
# Test the rep_add_doc command
|
||||
process = subprocess.Popen(f"dd if=/dev/urandom of={FILES_PATH}test.txt bs=1024 count=1000 ", shell=True)
|
||||
process = subprocess.Popen(f"dd if=/dev/zero of={FILES_PATH}test.txt bs=1024 count=1000 ", shell=True)
|
||||
process.wait()
|
||||
assert process.returncode == 0
|
||||
|
||||
|
|
Loading…
Reference in New Issue