cryptAES/main.py
2021-10-18 17:00:28 +02:00

32 lines
820 B
Python

from Crypto.Random import get_random_bytes
import os
from Backup import Backup
if not os.path.exists("key"):
key = get_random_bytes(32) # 32 bytes * 8 = 256 bits (1 byte = 8 bits)
open("key", 'wb').write(key)
print("Saved")
else:
key = open("key", 'rb').read()
print("Recovered")
print(key)
application_key_id = '003aa00745ec42a0000000003'
application_key = 'K003zMa5e07FheUrB38/fqKFfHSlXok'
bucket_id = '6a1a9000075465fe7cc4021a'
bdd = "bdd.db"
bck = Backup(key, bdd, app_key_id=application_key_id, app_key=application_key, bucket_id=bucket_id)
bck.save_location = "crypted"
rootdir = "test"
bck.recurse(rootdir)
# base = DataBase(bdd)
# file1 = {'name': "testname", 'path': "pathtest"}
# file2 = {'name': "secondname", 'path': "secondpath"}
# truc = []
# truc.append(file1)
# base.add(truc)