In Debian, I'll encrypt a file or text:

$ echo test | openssl enc -aes-256-cbc -in - -pass pass:password -out /tmp/test.enc

Then move the file to macOS (Mojave) and attempt to decrypt:

$ openssl enc -d -aes-256-cbc -in /tmp/test.enc -pass pass:password
bad decrypt
4426204780:error:06FFF064:digital envelope routines:CRYPTO_internal:bad decrypt:/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-22.200.4/libressl-2.6/crypto/evp/evp_enc.c:533:

This -d command decrpyts properly in Debian but not macOS. Could someone shed some light on what's going on and how I can use openssl to encrypt/decrypt between the two operating systems?

Debian openssl version:

$ openssl version -v
OpenSSL 1.1.0h  27 Mar 2018

macOS openssl version:

$ openssl version -v
LibreSSL 2.6.4
  • Just tested on Mojava (with a locally encrypted file): Decrypting using your command worked without problems.
    – nohillside
    Oct 27, 2018 at 11:42
  • No, you have to encrypt the file using Debian. Decrypting with Mojave works fine if the file was also encrypted with Mojave. I'm trying to get it working between different operating systems.
    – lily
    Oct 27, 2018 at 11:44
  • How do you transfer the file from Debian to macOS? Does it work if you encrypt on macOS and decrypt on Debian? Does it work if you use a different cipher?
    – nohillside
    Oct 27, 2018 at 11:46
  • Transfer using a USB or netcat or something. Encrypting with Mojave doesn't decrypt in Debian. But I just tried encrypting with Ubuntu (openssl v1.0.2g) and it decrypted in Mojave with errors. So maybe a temporary workaround there. Still, would like a Debian/Mojave solution. I'll try different ciphers now, thanks for the suggestion
    – lily
    Oct 27, 2018 at 11:51
  • Okay, if you think the question will get more exposure there :(
    – lily
    Oct 27, 2018 at 12:15


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.