mirror of
https://github.com/kevinveenbirkenbach/splitted-secret.git
synced 2024-11-22 10:11:05 +01:00
In between commit implementation of main data encryption
This commit is contained in:
parent
a00550e0b6
commit
2b3e4932c2
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,6 +1 @@
|
||||
data/decrypted/group_files/*
|
||||
data/decrypted/user_files/*
|
||||
data/encrypted/group_files/*
|
||||
data/encrypted/user_files/*
|
||||
accumulated.json*
|
||||
__pycache__
|
@ -39,6 +39,8 @@ END_OF_INPUTS
|
||||
```bash
|
||||
pip install numpy
|
||||
gpg
|
||||
ecryptfs-utils
|
||||
ecryptfs-simple
|
||||
python
|
||||
pip
|
||||
```
|
||||
@ -54,4 +56,5 @@ END_OF_INPUTS
|
||||
- https://wiki.ubuntuusers.de/GoCryptFS/
|
||||
- https://pynative.com/python-generate-random-string/
|
||||
- https://www.studimup.de/abitur/stochastik/anzahl-der-m%C3%B6glichketen-berechnen-kombinatorik/
|
||||
- https://numpy.org/doc/stable/reference/generated/numpy.base_repr.html?highlight=base_repr#numpy.base_repr
|
||||
- https://numpy.org/doc/stable/reference/generated/numpy.base_repr.html?highlight=base_repr#numpy.base_repr
|
||||
- https://linuxconfig.org/how-to-create-compressed-encrypted-archives-with-tar-and-gpg
|
2
data/.gitignore
vendored
Normal file
2
data/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*.gpg
|
||||
*.txt
|
1
data/decrypted/.gitignore
vendored
Normal file
1
data/decrypted/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
main_data/*
|
1
data/decrypted/group_files/.gitignore
vendored
Normal file
1
data/decrypted/group_files/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.txt
|
1
data/decrypted/user_files/.gitignore
vendored
Normal file
1
data/decrypted/user_files/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.json
|
1
data/encrypted/group_files/.gitignore
vendored
Normal file
1
data/encrypted/group_files/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.gpg
|
1
data/encrypted/user_files/.gitignore
vendored
Normal file
1
data/encrypted/user_files/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.gpg
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user