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:  http://www.ibm.com/developerworks/java/jdk/linux/download.html ].
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 java.security 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 com.ibm.crypto.provider import *
#decrypt
myencpwd = 'xxxxxxxxxx' # this is the encrypted input
pwd = "mypassword"
salt = "ABC123"
count = 32
Security.addProvider(Class.forName("com.ibm.crypto.provider.IBMJCE").newInstance())
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

Regards,
Claude    


Claude Falbriard
Certified IT Specialist L2 - Middleware
AMS Hortolāndia / SP - Brazil
phone:    +55 19 9837 0789
cell:         +55 13 8117 3316
e-mail:    claudef@br.ibm.com




From:        vijetha kulal <vijetha1188@gmail.com>
To:        Santoso Wijaya <santoso.wijaya@gmail.com>, jython-users@lists.sourceforge.net,
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?

Thanks
Vij


On Wed, Apr 24, 2013 at 11:09 AM, vijetha kulal <vijetha1188@gmail.com> 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?

Thanks
Vij



On Thu, Apr 18, 2013 at 9:02 PM, Santoso Wijaya <santoso.wijaya@gmail.com> wrote:
Hi,

Have you looked into pycrypto (https://www.dlitz.net/software/pycrypto/)?



~/santoso


On Thu, Apr 18, 2013 at 3:59 AM, vijetha kulal <vijetha1188@gmail.com> wrote:
Hi

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);

Thanks
Viji

------------------------------------------------------------------------------
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!

http://www2.precog.com/precogplatform/slashdotnewsletter
_________________________ ______________________
Jython-users mailing list

Jython-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users



------------------------------------------------------------------------------
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!
http://p.sf.net/sfu/newrelic_d2d_apr_________ _________________________ _____________
Jython-users mailing list
Jython-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users