# Practical 6 – Cloud Security: Generate Encryption Key
# Install: pip install cryptography
# Run second, from the same folder:
#   python p6_cloudSec_keys.py
# Creates secret.key, which the upload and download scripts need. Keep it safe.
from cryptography.hazmat.primitives.ciphers.aead import AESGCM

key = AESGCM.generate_key(bit_length=256)

with open("secret.key", "wb") as f:
    f.write(key)

print("AES-256 key generated successfully.")

# What this code does: generates a 256-bit AES key and saves it in secret.key
# for the file encryption and decryption scripts.