Information Security Stack Exchange is a question and answer site for information security professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I encrypted a file on my mac using openssl

openssl aes-256-cbc -a -salt -in one.jpg -out two.jpg

now if I try to decrypt it like that:

openssl aes-256-cbc -a -d -salt -in two.jpg -out one.jpg

on my original machine, it works fine. But if I perform the same operation on another machine, it doesn't work. Why is that?

share|improve this question

closed as too broad by Gilles, dr jimbob, Xander, Lucas Kauffman, Adi Jun 25 '13 at 22:29

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

Could you provide the errors to us? – Lucas Kauffman Jun 25 '13 at 17:17
There are no errors, it executes fine. But I cannot open the decrypted file because it wasn't correctly written. – NoobDev4iPhone Jun 25 '13 at 17:20
Does the output file have the expected size? Are its contents garbage, or is there anything recognizable? – Keith Thompson Jun 25 '13 at 17:28
Have you verified that you are truly trying to decrypt the same file on both sides by comparing 'md5sum one.jpg' and 'md5sum two.jpg'? – gowenfawr Jun 25 '13 at 17:56
This should be a straightforward task; just replicated myself on Linux Mint Debian and OS X with no issues (files were identical). It appears something is going wrong in your tool chain. While my guess is its something benign; you may have a rootkit on one of your systems that replaced OpenSSL with something that say leaves a backdoor (but doesn't let encrypted files properly transmit). – dr jimbob Jun 25 '13 at 20:39

I just verified this by running the commands on a Debian Wheezy and an Ubuntu 10.04, I did not encounter any issues whatsoever, so I suspect that something might be wrong with the file itself. Make sure to check the integrity after transfer as suggested by gowenfawr in the comments.

You can check the integrity by running md5sum on both machines. This should yield the same values. If they don't then the files differ on byte level.

It might also be the Byte Order Mark per suggestion in this superuser question. But as said, it would be helpful to know your machines and openssl version.

share|improve this answer
That's not really an answer to his question. – Johnny Jun 25 '13 at 19:58
How is it not an answer? As also suggested by other members the file might be corrupted during transfer which causes this behavior. – Lucas Kauffman Jun 25 '13 at 20:10
@Johnny It might not be a final answer, but it is helpful to determine the potential problem. Vote as you wish, but replicating the steps on another environment is generally helpful. – schroeder Jun 25 '13 at 20:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.