Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.lang.IllegalStateException: Cipher not initialized during loadtest

811899Nov 9 2010 — edited Nov 9 2010
Hi All,

Below is my code :

static Cipher pbeCipher;
.........


byte[] encbytes = hexToByte( encrypted );
pbeCipher.init( javax.crypto.Cipher.DECRYPT_MODE, pbeKey, pbeParamSpec );
byte[] decbytes ;
synchronized (pbeCipher) {
decbytes = pbeCipher.doFinal( encbytes );
}
return new String( decbytes );

I got the below exception when we are actually performing the load tests where in 4000 hits are made on the code in 1 min.

java.lang.IllegalStateException: Cipher not initialized
at javax.crypto.Cipher.c(Unknown Source)
at javax.crypto.Cipher.doFinal(Unknown Source)

My doubt here is : Is it occuring becuase of synchronizing issue? As shown in the code above i had synchronized the doFinal call. Still the exceptions are occuring. These are randomly coming say 1 out of 500 hits.

Please suggest me a solution on how to fix this. We are using PBEWithMD5AndDES encryption mechanism in this case.

Solution for this would help me a lot in terms of fixing it...

Thanks in Advance......
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 7 2010
Added on Nov 9 2010
1 comment
6,120 views