OpenSSL decrypt yields bad decrypt for a single file

Hi,

I encrypted a single file (an android keystore, if it matters) on a Windows 10 machine using powershell with the following command (after logging in with travis login --com)

travis encrypt-file unitytest.keystore

Travis automatically adds the command to .travis.yml.

After adding the encrypted file and pushing it along with the yml file change, the OSX build job yields:

openssl aes-256-cbc -K $encrypted_b21a1f34a42c_key -iv $encrypted_b21a1f34a42c_iv -in unitytest.keystore.enc -out unitytest.keystore -d

bad decrypt

140735538557832:error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length:/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-22/libressl/crypto/evp/evp_enc.c:519:

Is this because I’m encrypting on windows and decrypting on mac?

Found https://github.com/travis-ci/travis-ci/issues/4746 after googling for a while. Looks. like this is a long time unresolved issue when encrypting on windows. Guess I’ll have to install Linux

Problem solved by installing Ubuntu in a Virtual Box and doing the same there.
For future Googlers:

I had to set up a shared folder to get the original file into the VM, then mount that folder in the VM, then do:

sudo apt-get install gcc
sudo apt-get install make
sudo apt-get install ruby-dev
sudo apt-get install git
sudo gem install travis
(setup git as usual, google this if you don't know. Then git clone your repository)
travis login --com
travis encrypt-file <filename> --com --add
git add .travis.yml
git add <filename>.enc
git commit -m "Replace this text by a valid description"
git push
1 Like

Hey @Timmeey86

Worked like a charm.
I’m also running Windows 10.
Eventually gave up then decided to continue at home (Ubuntu 18.04).
Build passed this error on first try.
Thanks!

– Future Googler

You can mark a post as a solution by pressing the tick icon below it.