encryption Package

data_encryption_handler

class tvb.storage.h5.encryption.data_encryption_handler.DataEncryptionHandler[source]

Bases: object

APP_ENCRYPTION_HANDLER = 'APP_ENCRYPTION_HANDLER'
CRYPTO_PASS = 'CRYPTO_PASS'
ENCRYPTED_FOLDER_SUFFIX = '_encrypted'
KEYS_FOLDER = '.storage-keys'
static app_encryption_handler()[source]
check_and_delete(**kw)

New function will actually write the Lock.

static compute_encrypted_folder_path(current_project_folder)[source]
dec_queue_count(**kw)

New function will actually write the Lock.

dec_running_op_count(**kw)

New function will actually write the Lock.

static encryption_enabled()[source]
file_helper = <tvb.storage.h5.file.files_helper.FilesHelper object>
inc_project_usage_count(**kw)

New function will actually write the Lock.

inc_running_op_count(**kw)

New function will actually write the Lock.

is_in_usage(folder)[source]
linked_projects = {}
lock = <unlocked _thread.lock object>
marked_for_delete = {}
static project_key_path(project_name)[source]
push_folder_to_sync(folder)[source]
queue_elements_count = {}
running_operations = {}
set_project_active(project, linked_dt)[source]
set_project_inactive(project)[source]
startup_cleanup()[source]
sync_folders(folder)[source]
sync_project_queue = <queue.Queue object>
users_project_usage = {}
class tvb.storage.h5.encryption.data_encryption_handler.DataEncryptionHandlerBuilder[source]

Bases: object

static build_handler()[source]
class tvb.storage.h5.encryption.data_encryption_handler.DataEncryptionHandlerMeta[source]

Bases: type

Metaclass used to generate the singleton instance

class tvb.storage.h5.encryption.data_encryption_handler.DataEncryptionRemoteHandler[source]

Bases: DataEncryptionHandler

check_and_delete(**kw)

New function will actually write the Lock.

dec_queue_count(**kw)

New function will actually write the Lock.

dec_running_op_count(**kw)

New function will actually write the Lock.

inc_project_usage_count(**kw)

New function will actually write the Lock.

inc_running_op_count(**kw)

New function will actually write the Lock.

is_in_usage(**kw)

New function will actually write the Lock.

lock = <unlocked _thread.lock object>
push_folder_to_sync(folder)[source]
set_project_active(project, linked_dt)[source]
set_project_inactive(project)[source]
startup_cleanup()[source]
sync_folders(folder)[source]
class tvb.storage.h5.encryption.data_encryption_handler.FoldersQueueConsumer(group=None, target=None, name=None, args=(), kwargs=None, *, daemon=None)[source]

Bases: Thread

mark_stop()[source]
marked_stop = False
run()[source]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

was_processing = False
exception tvb.storage.h5.encryption.data_encryption_handler.InvalidStorageEncryptionException(message)[source]

Bases: TVBException

Exception thrown when encryption storage cannot be allowed.

encryption_handler

class tvb.storage.h5.encryption.encryption_handler.EncryptionHandler(dir_gid)[source]

Bases: object

cleanup_encryption_handler()[source]
decrypt_files_to_dir(files: list, dir: str) list[source]

Given a list of encrypted files, decrypt them, then move plain files to the location specified by :param dir

decrypt_results_to_dir(dir: str, from_subdir: str | None = None) list[source]

Having an already encrypted directory, decrypt all files, then move plain files to the location specified by :param dir

encrypt_inputs(files_to_encrypt: list, subdir: str | None = None) list[source]

Receive a list with all files to encrypt. Prepare encryption directory and encrypt each file. Return a list with all files from the encrypted directory.

encrypted_dir_name_regex = 'cipher_{}'
encrypted_suffix = '.aes'
static generate_random_password()[source]
get_encrypted_dir()[source]
get_password_file()[source]

import_export_encryption_handler

This module contains the necessary methods for encryption and decryption at import/export.

class tvb.storage.h5.encryption.import_export_encryption_handler.ImportExportEncryptionHandler[source]

Bases: object

DECRYPTED_DATA_SUFFIX = '_decrypted'
ENCRYPTED_DATA_SUFFIX = '_encrypted'
ENCRYPTED_PASSWORD_NAME = 'encrypted_password.pem'
PRIVATE_KEY_NAME = 'private_key.pem'
PUBLIC_KEY_NAME = 'public_key.pem'
add_encrypted_suffix(name)[source]
decrypt_content(encrypted_aes_key_path, upload_paths, private_key_path)[source]
encrypt_and_save_password(public_key_path, password, path_to_encrypted_password)[source]
encrypt_data_at_export(file_path, password)[source]
static encrypt_password(public_key, symmetric_key)[source]
extract_encrypted_password_from_list(file_list)[source]
generate_public_private_key_pair(key_path)[source]
get_path_to_encrypt(input_path)[source]
static load_public_key(public_key_path)[source]
save_encrypted_password(encrypted_password, path_to_encrypted_password)[source]