I am new to this so go easy on me. I had this dropped in my lap and have 
limited info but here is what I have.

I was sent 2 files and a partial java code that another company uses to decrypt.


import java.io.InputStream;
 
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
 
byte[] encryptedData = (byte[])msg.getBody().get();
                        byte[] decryptionKey = 
readFileContents("/keyfile_3des");                            
                        final SecretKey key 
= new SecretKeySpec(decryptionKey, "DESede");
 
                        _log.debug("Creating Cipher ...");
                        final IvParameterSpec iv 
= new IvParameterSpec(new byte[8]);
                        final Cipher decipher = 
Cipher.getInstance("DESede/CBC/PKCS5Padding");
                        decipher.init(Cipher.DECRYPT_MODE, key, iv);
 
                        _log.debug("Performing Decryption ...");
                        final byte[] decryptedData = 
decipher.doFinal(encryptedData);

I am trying to get the same result with decrypting in openssl
$ openssl enc -d -kfile keyfile_3des.txt -in encrypt.20120109.160000.txt -out 
test1.txt -des-ede-cbc -nosalt

I thought that the default padding for openssl was pkcs5 but I get what seems 
to me to be a padding error
bad decrypt
140735237683644:error:06065064:digital envelope 
routines:EVP_DecryptFinal_ex:bad decrypt:evp_enc.c:467:

It will run without error if I use -nopad but does not decrypt the file. Also 
no error with -des-ede-cfb. I am not all that familiar with java and don't know 
how to finish the partial jumbled code that I was sent either. I would greatly 
appreciate any help with openssl or the partial java code.

Philip Landreth
plandr...@cdsxrx.com
philip.landr...@gmail.com

Reply via email to