jasypt4py

Cipher functions that produce Jasypt/Bouncycastle compatible password encryption.


Keywords
jasypt, bouncycastle, AES, crypto, SHA256
License
Apache-2.0
Install
pip install jasypt4py==0.0.3

Documentation

Jasypt for Python

A python module that produces Jasypt/Bouncycastle compatible hashes and encrypted passwords.

Prerequisites

Any python environment that can run pycrypto.

Installation

Download the packaged jasypt4py module and install it with pip.

Example pip Installation:

pip install -U jasypt4py

Limitations

Currently only supports PBEWITHSHA256AND256BITAES-CBC-BC from Jasypt/Bouncycastle.

Usage

See tests.

Encryption

Jasypt encryption function:

$JASYPT_HOME/bin/encrypt.sh providerClassName = "org.bouncycastle.jce.provider.BouncyCastleProvider" \
                            saltGeneratorClassName = "org.jasypt.salt.RandomSaltGenerator" \
                            algorithm = "PBEWITHSHA256AND256BITAES-CBC-BC" \
                            password = 'pssst...don\'t tell anyone' \
                            keyObtentionIterations = 4000 \
                            input = 'secret value'

is equivalent to:

from jasypt4py import StandardPBEStringEncryptor

cryptor = StandardPBEStringEncryptor('PBEWITHSHA256AND256BITAES-CBC')

cryptor.encrypt('pssst...don\'t tell anyone', 'secret value', 4000)

Decryption

Jasypt decryption function:

$JASYPT_HOME/bin/decrypt.sh providerClassName = "org.bouncycastle.jce.provider.BouncyCastleProvider" \
                            saltGeneratorClassName = "org.jasypt.salt.RandomSaltGenerator" \
                            algorithm = "PBEWITHSHA256AND256BITAES-CBC-BC" \
                            password = 'pssst...don\'t tell anyone' \
                            keyObtentionIterations = 4000 \
                            input = 'xgX5+yRbKhs4zSubkAPkg9gSBkZU6XWt7csceM/3xDY='

is equivalent to:

from jasypt4py import StandardPBEStringEncryptor

cryptor = StandardPBEStringEncryptor('PBEWITHSHA256AND256BITAES-CBC')

cryptor.decrypt('pssst...don\'t tell anyone', 'xgX5+yRbKhs4zSubkAPkg9gSBkZU6XWt7csceM/3xDY=', 4000)