diff --git a/delivery2/client/bin/rep_decrypt_file b/delivery2/client/bin/rep_decrypt_file index 6adff75..7516f60 100755 --- a/delivery2/client/bin/rep_decrypt_file +++ b/delivery2/client/bin/rep_decrypt_file @@ -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) diff --git a/delivery2/client/tests/test_client.py b/delivery2/client/tests/test_client.py index 48d1dd6..8cc5b42 100644 --- a/delivery2/client/tests/test_client.py +++ b/delivery2/client/tests/test_client.py @@ -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