|
From: Steven L. <Ste...@Pr...> - 2003-05-26 02:42:13
|
Hi all, The verion of cryptix is cryptix-jce-20030217-snap.zip. I'm using TripleDES for encryption/decryption. Problems seem to arise when I try to decrypt.=20 It seems to fail sometimes with the following errors: 1.=20 java.lang.NegativeArraySizeException at cryptix.jce.provider.cipher.BlockCipher.engineDoFinal(BlockCipher.java:3= 78) 2.=20 java.lang.ArrayIndexOutOfBoundsException at java.lang.System.arraycopy(Native Method) at cryptix.jce.provider.cipher.BlockCipher.engineDoFinal(BlockCipher.java:3= 79) 3. Or the decrypted text does not match the original encrypted text. eg original text -- 5555264558486571 encrypted text -- ?=A8=A5o=1E:N=EE=BC>=7F=F6=3D*lOE%=E9=A7=D0=AC`=F2=F0 decrypted text -- =D2Yf?=BEC=D0-58486571 --------------- I wanted to use my own key for encryption, generating it using the SecrtKeySpec. But the results caused the above, so I tried the = KeyGenerator, but with no better results. (code snippets below.) ------ static private final String ENCRYPTIONTYPE =3D "TripleDES"; byte [] keyData =3D shortKeyString.getBytes(); key =3D new SecretKeySpec(keyData,ENCRYPTIONTYPE); where shortKeyString is a String of length 24. ---- static private final int des3KeyStrength =3D 168; KeyGenerator keyGen =3D KeyGenerator.getInstance(ENCRYPTIONTYPE); keyGen.init(des3KeyStrength); key =3D keyGen.generateKey(); ---- Does anyone know what is wrong? Is it something I have done? Regards, Steven. The information transmitted is intended only for the person or entity = to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you = received this in error, please contact the sender and delete the material from = any computer=20 |