Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.

中文文档请访问README_zh.md

encfile Official Documentation

Introduction

Welcome to the encfile library documentation! encfile is a powerful Python library that provides file encryption and decryption functionality. It uses the RSA encryption algorithm and the AES encryption algorithm, supporting both hybrid RSA-AES encryption and pure RSA encryption schemes.

Installation

You can install the encfile library using the pip command:

pip install FileEncTool

Usage Examples

Generating RSA Key Pair

To generate an RSA key pair and save the private key and public key to files, you can use the generate_rsa_keypair function:

from encfile import generate_rsa_keypair

# Generate an RSA key pair and save to files
generate_rsa_keypair(priv_file='private_key.pem', pub_file='public_key.pem')

You can specify the paths for the private key file and public key file. By default, feedback messages are displayed during the key generation process. You can disable the feedback messages by setting the show_feedback parameter to False, as shown below:

from encfile import generate_rsa_keypair

# Generate an RSA key pair and save to files
generate_rsa_keypair(priv_file='private_key.pem', pub_file='public_key.pem', show_feedback=False)

Hybrid RSA-AES Encryption

To encrypt a file using the hybrid RSA-AES encryption scheme, you can use the rsa_aes_encrypt_file function:

from encfile import rsa_aes_encrypt_file

# Encrypt a file using hybrid RSA-AES encryption
rsa_aes_encrypt_file(file_path='plaintext.txt', key_path='public_key.pem', backpath='encrypted_file.enc')

You need to provide the path of the file to be encrypted, the path of the RSA public key file, and the path to save the encrypted file. By default, feedback messages are displayed during the encryption process. You can disable the feedback messages by setting the show_feedback parameter to False, similar to the previous examples.

Hybrid RSA-AES Decryption

To decrypt a file encrypted using the hybrid RSA-AES encryption scheme, you can use the rsa_aes_decrypt_file function:

from encfile import rsa_aes_decrypt_file

# Decrypt a file encrypted using hybrid RSA-AES encryption
rsa_aes_decrypt_file(file_path='encrypted_file.enc', key_path='private_key.pem', backpath='decrypted_file.txt')

You need to provide the path of the encrypted file, the path of the RSA private key file, and the path to save the decrypted file. By default, feedback messages are displayed during the decryption process. You can disable the feedback messages by setting the show_feedback parameter to False, as mentioned above.

Pure RSA Encryption

To encrypt a file using the pure RSA encryption scheme, you can use the rsa_encrypt_file function:

from encfile import rsa_encrypt_file

# Encrypt a file using pure RSA encryption
rsa_encrypt_file(file_path='plaintext.txt', key_path='public_key.pem', backpath='encrypted_file.enc', use_multithreading=False, show_progress=False, show_feedback=False)

You need to provide the path of the file to be encrypted, the path of the RSA public key file, and the path to save the encrypted file. By default, the encryption process uses multithreading and displays a progress bar. You can disable multithreading by setting the use_multithreading parameter to False and disable the progress bar by setting the show_progress parameter to False. By default, feedback messages are displayed during the encryption process. You can disable the feedback messages by setting the show_feedback parameter to False, as shown in the code above.

Pure RSA Decryption

To decrypt a file encrypted using the pure RSA encryption scheme, you can use the rsa_decrypt_file function:

from encfile import rsa_decrypt_file

# Decrypt a file encrypted using pure RSA encryption
rsa_decrypt_file(file_path='encrypted_file.enc', key_path='private_key.pem', backpath='decrypted_file.txt')

You need to provide the path of the encrypted file, the path of the RSA private key file, and the path to save the decrypted file. By default, feedback messages are displayed during the decryption process. You can disable the feedback messages by setting the show_feedback parameter to False, as mentioned above.

Conclusion

The encfile library provides convenient asymmetric file encryption and decryption capabilities. You can use either the RSA-AES hybrid encryption or the pure RSA encryption scheme to protect your files. Make sure to securely store your private key file to prevent data leaks. If you have any further questions, please refer to the comments in the init.py file or contact the author.

License

This project is licensed under the AGPL 3.0 license. See the LICENSE file for details.

Metadata

Release files for FileEncTool 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for FileEncTool 1.0.1
File Size Uploaded
FileEncTool-1.0.1.tar.gz 17.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for FileEncTool 1.0.1
File Interpreter ABI Platform
FileEncTool-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 34.7 kB

Release files / FileEncTool-1.0.1.tar.gz

Download URL FileEncTool-1.0.1.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
33cc47aa48913ef3283fe187ff3594eb38b46dcf07c529fd09b08967019dcf5d
BLAKE2b-256 checksum
How to use checksums
5d02564d466815a63976506b96f2f5eaad2ff4aef6f5a17caea813a2935164ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release files / FileEncTool-1.0.1-py3-none-any.whl

Download URL FileEncTool-1.0.1-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6fc2f518438aef8138e75a569d1113f111520275bdf6e6e7e609a1595304e76d
BLAKE2b-256 checksum
How to use checksums
6318dcaf5e866789384ca146b0881ba16e9ea0baa18fca1c4b0add0d411ad8ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page