2

The following file encryption method works on OS X Yosemite:

Encrypt: openssl enc -aes-256-cbc -salt -in file.zip -out file.zip.enc

Decrypt: openssl enc -aes-256-cbc -d -in file.zip.enc -out file.zip

However, when on OS X El Capitan I get this error:

unknown option '-aes-256-cbc -in file.enc'

Any solutions?

1 Answer 1

1

You likely have a shell quoting problem. The command works just fine for me in 10.11.4:

> which openssl
/usr/bin/openssl

> openssl version
OpenSSL 0.9.8zh 14 Jan 2016

> openssl enc -aes-256-cbc -salt -in file.zip -out file.zip.enc; echo $?
enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:
0

> openssl enc -aes-256-cbc -d -in file.zip.enc -out file.zip; echo $?
enter aes-256-cbc decryption password:
0

Check to make sure that your calling program is treating -aes-256-cbc as a single option and isn't quoting it when sending it in to the shell. It looks like it's calling the program with option cluster "-aes-256-cbc -in file.enc" which actually isn't a valid, single option for openssl.

If you can provide more details about how you're calling openssl I can give you more specific guidance.

1
  • It worked. You are right. There is nothing inherently wrong with the method, except that my program was treating "-aes-256-cbc -in file.enc" as a single option for some unbeknown reason. Thanks. Cheers. :)
    – user182736
    Commented May 11, 2016 at 21:42

You must log in to answer this question.