Solved decryption encryption bug

This commit is contained in:
Kevin Veen-Birkenbach 2022-12-11 10:19:35 +01:00
parent c85c108db5
commit 4c3661de76
4 changed files with 15 additions and 5 deletions

View File

@ -4,6 +4,11 @@ The purpose of this software is to splitt a secret over multiple people. Just if
# testing # testing
```bash ```bash
python scripts/main.py --mode cleanup && python scripts/main.py --mode cleanup &&
echo "werewrw" > data/decrypted/main_data/test123.txt
echo "werewrw" > data/decrypted/main_data/test124.txt
mkdir data/decrypted/main_data/folder
echo "werewrw" > data/decrypted/main_data/folder/test124.txt
python scripts/main.py --amount 3 --quota 50 --mode encrypt --add-user-information --master-password "ewrwerwerew" << END_OF_INPUTS python scripts/main.py --amount 3 --quota 50 --mode encrypt --add-user-information --master-password "ewrwerwerew" << END_OF_INPUTS
alpha bravo alpha bravo
123123812908 123123812908
@ -21,9 +26,10 @@ END_OF_INPUTS
python scripts/main.py --mode decrypt --master-password "ewrwerwerew" python scripts/main.py --mode decrypt --master-password "ewrwerwerew"
python scripts/main.py --mode cleanup --file-types decrypted && python scripts/main.py --mode decrypt --user "1" --user-password "DDB2QYHP4X0PDR0ZX9LBLACNL6VAXLXMNEZJDOOGUTENSI6UDYGPOR5CV01YLI49" << END_OF_INPUTS python scripts/main.py --mode cleanup --file-types decrypted &&
python scripts/main.py --mode decrypt --user "1" --user-password "Y4GYTEW80SCQQDTIKOJ6YNCIP6MBBEM68SCKBAA1VWAQFRSPNGHEBKHSFZQENDRB" << END_OF_INPUTS
2 2
EOQXCYGEY2IMKAJP5VOCRVRH9LPYAPK9IC0ID0GMSJ5KXNXJHPNUBUKEVLE2WHQJ VGCQPW2LIKJ7SDFFLUZXBXGFPZ6L8RGPTS7TLCNN9GLR82RPHRSN34YZUXF0L27V
END_OF_INPUTS END_OF_INPUTS
``` ```
# Requirements to know # Requirements to know
@ -48,6 +54,7 @@ END_OF_INPUTS
- implement tails setup script - implement tails setup script
- add data-input attribut - add data-input attribut
- add data-output attribut - add data-output attribut
- write scenario test
## Further Information ## Further Information
- https://www.tutorialspoint.com/python/python_command_line_arguments.htm - https://www.tutorialspoint.com/python/python_command_line_arguments.htm

View File

@ -114,4 +114,6 @@ class Decryption():
self.decryptFile(self.user_password, input_file_path, output_file_path) self.decryptFile(self.user_password, input_file_path, output_file_path)
def decryptMainData(self): def decryptMainData(self):
self.cli.executeCommand('gpg --batch --passphrase "' + self.getMasterPassword() + '" -d "' + self.paths.getEncryptedMainDataFile() + '" | tar -xvzf - "' + self.paths.getDecryptedMainDataStandartFolder() + '"') self.cli.executeCommand('gpg --batch --passphrase "' + self.getMasterPassword() + '" -d "' + self.paths.getEncryptedMainDataFile() + '" | tar --one-top-level="' + self.paths.getDecryptedMainDataStandartFolder() + '" -xvzf -')
print(self.cli.getCommandString())
print(self.cli.getOutputString())

View File

@ -127,7 +127,9 @@ class Encryption():
self.encryptToJsonFile(data,file_path,self.master_password) self.encryptToJsonFile(data,file_path,self.master_password)
def encryptMainData(self): def encryptMainData(self):
self.cli.executeCommand('tar -cvzf - "' + self.paths.getDecryptedMainDataStandartFolder() + '" | gpg -c --batch --passphrase "' + self.master_password +'" > "' + self.paths.getEncryptedMainDataFile() + '"'); self.cli.executeCommand('tar -C"' + self.paths.getDecryptedMainDataStandartFolder() + '" -cvzf - ./ | gpg -c --batch --passphrase "' + self.master_password +'" > "' + self.paths.getEncryptedMainDataFile() + '"')
print(self.cli.getCommandString())
print(self.cli.getOutputString())
def encryptAll(self): def encryptAll(self):
self.encryptUserFile() self.encryptUserFile()

View File

@ -148,7 +148,6 @@ try:
encrypt.addInformationToUser(user_id, label, str(input())) encrypt.addInformationToUser(user_id, label, str(input()))
encrypt.compileData() encrypt.compileData()
encrypt.encryptAll() encrypt.encryptAll()
dirty_exit() dirty_exit()
except KeyboardInterrupt: except KeyboardInterrupt:
print("Program interrupted by user.") print("Program interrupted by user.")