Skip to content

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

License

Notifications You must be signed in to change notification settings

fareliner/jasypt4py

Repository files navigation

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 and PBEWITHSHA256AND128BITAES-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)

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages