Dear colleagues,

 I would suggest that you follow the Java road and try to implement the 3DES algorithm using package that comes integrated with the Java 6 SE distribution, before known as Oracle JCE.  The company I work distributes an extended version of the Java core, which is the IBM Java 6 and 7, which runs very well with the Jython language, but cryptography support is restricted to certain type of hardware,  as we often use accelerator boards. You can find the latest Java version for download at the IBMs developerWorks page [ here: ].
Oracles latest Java core version should also work OK.  Be aware that there might exist some size restriction at the 3DES key length due to export regulations. Below you find a short sample how to patch it it all together with Jython:

# a basic sample for symmetric key decryption
#imports required for cryptography
import java.lang.String as javaString
from javax.crypto import *
from import *
from javax.crypto.spec import *
from sun.misc import BASE64Encoder
from sun.misc import BASE64Decoder
#from com.sun.crypto import *
# replaces standard crypto provider by IBM's code
from import *
myencpwd = 'xxxxxxxxxx' # this is the encrypted input
pwd = "mypassword"
salt = "ABC123"
count = 32
pbeParamSpec = PBEParameterSpec(salt, count)
pbeKeySpec = PBEKeySpec(pwd)
keyFac = SecretKeyFactory.getInstance("PBEWithMD5AndDES");
pbeKey = keyFac.generateSecret(pbeKeySpec);
dcipher = Cipher.getInstance("PBEWithMD5AndDES")
dcipher.init(Cipher.DECRYPT_MODE, pbeKey, pbeParamSpec)
dec = BASE64Decoder().decodeBuffer(myencpwd)
utf8 = dcipher.doFinal(dec)
decrypted = javaString(utf8, "UTF8")
printstr = decrypted.toString()
print printstr


Claude Falbriard
Certified IT Specialist L2 - Middleware
AMS Hortolāndia / SP - Brazil
phone:    +55 19 9837 0789
cell:         +55 13 8117 3316

From:        vijetha kulal <>
To:        Santoso Wijaya <>,,
Date:        24/04/2013 11:21
Subject:        Re: [Jython-users] TripleDES encryption in Jython

I installed crypto and could import the same. But now I receive error "NO MODULE NAMED Cipher". I tried installing crypto.cypher but failed. I can't import cipher/DES3. Could you please help me out with this?


On Wed, Apr 24, 2013 at 11:09 AM, vijetha kulal <> wrote:
Hi, I downloaded pycrypto and I tried installing it using easy_install. But, I get some error and I'm not able to import crypto. Could you please give an example for how to use it?


On Thu, Apr 18, 2013 at 9:02 PM, Santoso Wijaya <> wrote:

Have you looked into pycrypto (


On Thu, Apr 18, 2013 at 3:59 AM, vijetha kulal <> wrote:

I use Jython-2.2.1 in nGrinder version 3.11 and JDK version 1.7.0_10.

How do I Encrypt a string using TripleDES encyption with my own key? Following is the code in C#:

string childRegistration = TripleDES.EncryptUnicode(childData, key);


Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
_________________________ ______________________
Jython-users mailing list

Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! _________________________ _____________
Jython-users mailing list