Drop-in replacement for ConfigParser with encryption support
Project description
configparser_crypt
Drop-In replacement for ConfigParser with encrypted ini file support
configparser_crypt is a drop-in replacement for configparser, that allows to read / write encrypted configuration files.
It is compatible with Python 3.5+ and is tested on both Linux and Windows.
Setup
pip install configparser_crypt
Usage
Just like configparser, except that we read/write binary files and have a AES key.
configparser example
-from configparser import ConfigParser
+from configparser_crypt import ConfigParserCrypt
file = 'config.ini'
-conf_file = ConfigParser()
+conf_file = ConfigParserCrypt()
# Add some values to the file
conf_file.add_section('TEST')
conf_file['TEST']['spam'] = 'eggs'
# Write config file
-with open(file, 'w') as file_handle:
- conf_file.write(file_handle)
+with open(file, 'wb') as file_handle:
+ conf_file.write_encrypted(file_handle)
# Read from config file
-conf_file = ConfigParser()
-conf_file.read(file)
+conf_file = ConfigParserCrypt()
+conf_file.aes_key = secure_key
+conf_file.read_encrypted(file)
# Check that config file contains 'spam = eggs'
assert conf_file['TEST']['spam'] == 'eggs'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for configparser_crypt-0.6.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fadf55b1a8ea2fce99160c5dc05c204706e410ed0552382a79dc30f2a500e2d3 |
|
MD5 | 9ee2bb90097a2d5e75cb28d38f181a4a |
|
BLAKE2b-256 | aa495d95c4659ff122c5548a6bb5bb42272fa5b2d1b30d5618a1d897a5ac0493 |