Skip to main content

Secure File Encryption Library

Project description

securefilecrypt — Simple AES-GCM File Encryption

SecureFileCrypt is a Python utility for encrypting and decrypting files using AES-256-GCM with password-based key derivation (PBKDF2-HMAC-SHA256).
It is designed for ease of use while providing strong, modern encryption with authentication to ensure data confidentiality and integrity.

Features

  • AES-256 in Galois/Counter Mode (GCM) for authenticated encryption
  • Password-based key derivation using PBKDF2-HMAC-SHA256 with configurable iterations
  • Random salt and nonce generated for each encryption
  • Automatic salt length derived from password characteristics
  • Simple file-based workflow: encrypt and decrypt with one function call
  • Compatible across Python 3.6+ on Windows, Linux, and macOS

Security Design

  • Encryption algorithm: AES-256-GCM (confidentiality + authentication)
  • Key derivation: PBKDF2-HMAC-SHA256, 100,000 iterations
  • Salt: Random per file, length based on password contents
  • Nonce: 12 bytes random per encryption
  • Password requirements: At least 12 base36 characters (0-9a-z)

Installation

pip install securefilecrypt

Quick Start

Encrypt a file

from securefilecrypt import EncryptFile

status, message = EncryptFile("secret.txt", "secret.enc", "mypassword123abc")
if not status:
  print("Error:", message)
else:
  print("File encrypted successfully!")

Decrypt a file

from securefilecrypt import DecryptFile

status, message = DecryptFile("secret.enc", "secret_decrypted.txt", "mypassword123abc")
if not status:
  print("Error:", message)
else:
  print("File decrypted successfully!")

API Reference

EncryptData(input_file, password)

Encrypts input_file using AES-256-GCM with provided password. Returns:

  • `status' (bool): True if successful, False something went wrong
  • message (str): Error message in case of error, otherwise empty
  • data (bytes): Encrypted bytes

DecryptData(input_file, password)

Decrypts input_file using AES-256-GCM with provided password. Returns:

  • `status' (bool): True if successful, False something went wrong
  • message (str): Error message in case of error, otherwise empty
  • data (bytes): Decrypted bytes

EncryptFile(input_file, output_file, password)

Encrypts input_file into output_file using AES-256-GCM with provided password. Returns:

  • `status' (bool): True if successful, False something went wrong
  • message (str): Error message in case of error, otherwise empty

DecryptFile(input_file, output_file, password)

Decrypts input_file into output_file using AES-256-GCM with provided password. Returns:

  • `status' (bool): True if successful, False something went wrong
  • message (str): Error message in case of error, otherwise empty

Security Notes

  • Always use a strong password (long, random, mix of letters/numbers).
  • Store your password securely — if lost, data cannot be recovered.
  • PBKDF2 is secure, but for higher resistance to GPU cracking, consider upgrading to Argon2id in the future.

License

MIT License — do anything with it, but no warranty.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

securefilecrypt-0.1.2.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

securefilecrypt-0.1.2-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file securefilecrypt-0.1.2.tar.gz.

File metadata

  • Download URL: securefilecrypt-0.1.2.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for securefilecrypt-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3ce01412fafed741078b6546c84fdb5d6e552e598199897bdf8c342b01f47e8a
MD5 ce06921a218829aebc178ffddaf6b65d
BLAKE2b-256 b9a539e2ffe45e501d791d3948fbfb0851ac553e1ef4b6124a53230b7b7d9ec3

See more details on using hashes here.

File details

Details for the file securefilecrypt-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for securefilecrypt-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7c9b5eb05b5cbded6d5e8e1ec91e03081766aafbd5c4d4787dced4937ea0c1f7
MD5 acf6c07840b53c1dafdd36941be95a08
BLAKE2b-256 71941fe1f75ec87fd6a9251b343c5c6c16d48cfb02b870c185e2c920d538440d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page