Skip to content

Data Encryption

Spera Alfredo Jeshoua edited this page May 14, 2025 · 5 revisions

VM Lab Project Structure Badge

Overview

Provides methods for password and SSH key encryption/decryption for sensitive data, like users passwords and VMs SSH Keys.

Prerequisites

The .streamlit/secrets.toml file must have a valid Fernet cipher key that can be generated in two ways:

  • In the terminal:
    openssl rand -base64 32
  • In the Python console:
    >>> from cryptography.fernet import Fernet
    >>> Fernet.generate_key()

Two libraries

Fernet

Fernet is used to encrypt/decrypt the passwords and SSH keys of the VMs (in the VM Table).

The fernet object is created in backend/fernet_encryption.py.

Bcrypt

Bcrypt is used to encrypt/decrypt the passwords of the Users (in the User Table).

The bcrypt object is imported directly in the User model (backend/models/user.py).

Clone this wiki locally