Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/clach04/openssl_enc_compat
Pure Python library that is compatible with OpenSSL 1.1.0+ encryption and decryption
https://github.com/clach04/openssl_enc_compat
aes aes-256 aes-cbc aes-encryption base64 decryption encryption encryption-decryption openssl pbkdf2 python python2 python27 python3
Last synced: 14 days ago
JSON representation
Pure Python library that is compatible with OpenSSL 1.1.0+ encryption and decryption
- Host: GitHub
- URL: https://github.com/clach04/openssl_enc_compat
- Owner: clach04
- License: lgpl-2.1
- Created: 2023-12-30T01:38:49.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-01T18:33:50.000Z (about 1 year ago)
- Last Synced: 2024-12-03T15:59:55.433Z (about 1 month ago)
- Topics: aes, aes-256, aes-cbc, aes-encryption, base64, decryption, encryption, encryption-decryption, openssl, pbkdf2, python, python2, python27, python3
- Language: Python
- Homepage: https://pypi.org/project/openssl-enc-compat/
- Size: 52.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# openssl_enc_compat
Pure Python 2.7 and 3.x library that is compatible with OpenSSL 1.1.0+ encryption and decryption.
https://github.com/clach04/openssl_enc_compatThis is intended to be used a library, rather than as a command line tool.
Can encrypt/decrypt raw binary and base64 encoded content.
Only supports aes-256-cbc with salt using pbkdf2. pbkdf2 iterations defaults to 10,000 to match OpenSSL default but can be specified.Also checkout:
* https://github.com/The-Crocop/pyaes256 - lots of dependencies with a nice API but limited to utf-8 data
* https://github.com/EbryxLabs/opencrypt - Python 3 only with a filename only API (and command line tools)
* https://github.com/Madhava-mng/openssltool - Python 3 only wapper around openssl command line tool## Sample
from openssl_enc_compat.cipher import OpenSslEncDecCompat
# echo hello| openssl enc -e aes-256-cbc -salt -pbkdf2 -iter 10000 -in - -base64 -out - -pass pass:password
openssl_crypted_base64_text = 'U2FsdGVkX18NXhFhTlAyvM2jXPu+hhsT344TvO0yLYk=' # base64
openssl_crypted_base64_text = b'Salted__\r^\x11aNP2\xbc\xcd\xa3\\\xfb\xbe\x86\x1b\x13\xdf\x8e\x13\xbc\xed2-\x89' # raw binary
password = b'password'print('openssl_crypted_base64_text: %r' % openssl_crypted_base64_text)
print('password: %r' % password)cipher = OpenSslEncDecCompat(password) # guess/default
plaintext = cipher.decrypt(openssl_crypted_base64_text) # guesses if base64 encoded or note
print('plaintext: %r' % plaintext)Quick demo:
python -m openssl_enc_compat.cipher
## Run tests
python -m openssl_enc_compat.tests.testsuite -v