This repository contains code for implementing end-to-end encryption (E2EE) for files using both AES (Advanced Encryption Standard) and RSA (Rivest–Shamir–Adleman) encryption algorithms in both Dart and Python.
- AES Encryption: Uses AES encryption algorithm for secure file encryption.
- Password Protection: Encrypts and decrypts files with a user-defined password.
- Synchronous Operations: Performs encryption and decryption operations synchronously for simplicity.
- Import the
aes_crypt_null_safe
andopen_file_plus
packages. - Initialize an
AesCrypt
instance, set a password, and use it to encrypt and decrypt files. - Open the decrypted file using
OpenFile.open
method.
String encryptedFile = await EncryptData.encryptFile(filePath, password);
String decryptedFile = await EncryptData.decryptFile(encryptedFile, password);
- AES Encryption: Utilizes AES for file encryption and decryption.
- Encryption Method: Encrypts a file with a specified path and password.
- Decryption Method: Decrypts an encrypted file using the same password.
- File Handling: Prints status messages and opens decrypted files using
OpenFile.open
.
- RSA Key Generation: Generates RSA key pairs asynchronously.
- JWK Conversion: Converts JSON Web Keys (JWK) to RSA private and public key strings asynchronously.
- Encryption with Public Key: Encrypts a message with a public key asynchronously.
- Install the
pyAesCrypt
package usingpip install pyAesCrypt
. - Use the provided
EncryptData
class to encrypt and decrypt files via command-line arguments.
-
Encrypt a file:
python main.py path/to/your/file.txt your-password
-
Decrypt a file:
python main.py path/to/your/file.txt.aes your-password --decrypt
- AES Encryption: Utilizes AES for file encryption and decryption.
- Encryption Method: Encrypts a file with a specified path and password.
- Decryption Method: Decrypts an encrypted file using the same password.
- File Handling: Prints status messages and provides the decrypted file path.
Ensure to handle and share passwords securely. Encrypted files are saved in the server directory for secure storage.