I try to read encrypted data, but always get java.io.IOException: last
block incomplete in decryption



Setup works like this:

                final KeySpec keySpec = new PBEKeySpec(passPhrase.toCharArray(),
SALT, ITERATIONS);
                key =
SecretKeyFactory.getInstance("PBEWithMD5AndDES").generateSecret(keySpec);
                //
                ecipher = Cipher.getInstance(key.getAlgorithm());
                paramSpec = new PBEParameterSpec(SALT, ITERATIONS);
                // Create the ciphers
                ecipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);


Reading the Input:

        public InputStream getDecryptStream(final InputStream out) throws
IOException
        {
                try
                {
                        ecipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
                }
                catch (InvalidKeyException e)
                {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
                catch (InvalidAlgorithmParameterException e)
                {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
                return new CipherInputStream(out, ecipher);
        }



Anyone can give me an Advice how to get it to work ?

Best regards,
Jens

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to