i have made a static instance of it in the services and do it at that level..here is the code
----------------------------------------- code -------------------------------------------- static { try { // theBigSecret : contains the 128 bit encrption key // ENCRYPTION_ALGORITHM : "AES" SecretKeySpec skeySpec = new SecretKeySpec(theBigSecret.getBytes(), ENCRYPTION_ALGORITHM); s_EncryptCipher = Cipher.getInstance(ENCRYPTION_ALGORITHM); s_EncryptCipher.init(Cipher.ENCRYPT_MODE, skeySpec); s_DecryptCipher = Cipher.getInstance(ENCRYPTION_ALGORITHM); s_DecryptCipher.init(Cipher.DECRYPT_MODE, skeySpec); } catch () .............. // Exception handling here } public static String decrypt(String s) throws AuthenticationServiceException{ try { return new String(s_DecryptCipher.doFinal(s.getBytes())); } catch (...) { // Exception Handling here } } /** * Function to encrypt the password * @param s string to be encrypted * @return the encrypted password */ public static String encrypt(String s) throws AuthenticationServiceException{ try { return new String(s_EncryptCipher.doFinal(s.getBytes())); } catch (IllegalBlockSizeException e) { //Exception handling here } } -------------------------------- code ends here ---------------------------------------------------- This works with MySql Db in the single threaded case but fails in the muti threaded case. Thanks in advance. On 6/9/06, Dave Newton <[EMAIL PROTECTED]> wrote:
Shshank Jain wrote: > any ideas ?? Not without any code. If you're doing it inside a Struts Action are you using an instance variable in the Action? Dave --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]