mirror of
https://github.com/kevinveenbirkenbach/splitted-secret.git
synced 2025-09-10 04:26:32 +02:00
In between commit implementation of main data encryption
This commit is contained in:
@@ -4,7 +4,7 @@ class AbstractSplittedSecret(Cli):
|
||||
USER_PASSWORD_LENGTHS = 64
|
||||
OVERALL_PASSWORD_LENGTHS = 128
|
||||
|
||||
# At the moment the programm can used deal with one digit numbers.
|
||||
# At the moment the programm can only deal with one digit numbers.
|
||||
MAXIMUM_SECRET_HOLDERS = 9
|
||||
MINIMUM_SECRET_HOLDERS = 2
|
||||
|
||||
|
@@ -110,4 +110,8 @@ class Decryption(AbstractSplittedSecret):
|
||||
def decryptAccumulatedFile(self):
|
||||
input_file_path = self.getAccumulatedFilePath(AbstractSplittedSecret.TYPE_ENCRYPTED)
|
||||
output_file_path = self.getAccumulatedFilePath(AbstractSplittedSecret.TYPE_DECRYPTED)
|
||||
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):
|
||||
# gpg --batch --passphrase "helloworld" -d data/encrypted/main_data.tar.gz.gpg | tar -xvzf -
|
||||
pass
|
@@ -100,19 +100,23 @@ class Encryption(AbstractSplittedSecret):
|
||||
def encryptToJsonFile(self,data,file_path,password):
|
||||
self.encryptStringToFile(json.dumps(data,ensure_ascii=False), file_path, password)
|
||||
|
||||
def encryptUserData(self):
|
||||
def encryptUserFile(self):
|
||||
for user_id in self.user_mapped_data:
|
||||
file_path=self.getUserFilePath(user_id,AbstractSplittedSecret.TYPE_ENCRYPTED)
|
||||
data=self.user_mapped_data[user_id]
|
||||
password=self.user_mapped_data[user_id]['user_password']
|
||||
self.encryptToJsonFile(data,file_path,password)
|
||||
|
||||
def encryptAccumulatedData(self):
|
||||
def encryptAccumulatedFile(self):
|
||||
file_path=self.getAccumulatedFilePath(AbstractSplittedSecret.TYPE_ENCRYPTED)
|
||||
data={"user_mapped": self.user_mapped_data, "group_mapped": self.group_mapped_data}
|
||||
self.encryptToJsonFile(data,file_path,self.master_password)
|
||||
|
||||
def encryptMainData(self):
|
||||
self.executeCommand('tar -cvzf - data/decrypted/main_data | gpg -c --batch --passphrase "' + self.master_password +'" > data/encrypted/main_data.tar.gz.gpg');
|
||||
pass
|
||||
|
||||
def encrypt(self):
|
||||
self.encryptUserData()
|
||||
self.encryptAccumulatedData()
|
||||
self.encryptUserFile()
|
||||
self.encryptAccumulatedFile()
|
||||
self.encryptGroupFiles()
|
||||
|
Reference in New Issue
Block a user