# Encrypting files "bad decrypt"

**URL:** <https://travis-ci.community/t/encrypting-files-bad-decrypt/11202>\
**Category:** Travis CI Discussions & Feedback\
**Tags:** bug\
**Created:** [February 23, 2021, 11:17am UTC](https://travis-ci.community/t/encrypting-files-bad-decrypt/11202 "2021-02-23T11:17:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex9849](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/alex9849/32/6215_2.png) [@alex9849](https://travis-ci.community/u/alex9849)\
**Post date:** [February 23, 2021, 11:17am UTC](https://travis-ci.community/t/encrypting-files-bad-decrypt/11202/1 "2021-02-23T11:17:19Z")

</div>

Hello,

I want to add an encrypted keystore-file to my repository and use it to sign an apk.  
I used this guide ([Encrypting Files - Travis CI](https://docs.travis-ci.com/user/encrypting-files/)) to encrypt my files. I tried it by using the “travis encrypt-file --pro mykestore.keystore”-command, and by manually encrypting the file with openssl and storing the password as a secret. Both attempts always lead to a “bad decrypt”-error.  
I’m using Windows 10, but also tried to encrypt the keystore on my linux server. Both files produce the same error.  
This are my attempts:

- Encrypted file with OpenSSL on my linux-server: [Travis CI - Test and Deploy with Confidence](https://travis-ci.com/github/alex9849/pi-cocktail-maker/jobs/485498417)
- Encrypted file with travis-cli: [Travis CI - Test and Deploy with Confidence](https://travis-ci.com/github/alex9849/pi-cocktail-maker/jobs/485493321)
- Encrypted file with OpenSSL on my Windows-PC: [Travis CI - Test and Deploy with Confidence](https://travis-ci.com/github/alex9849/pi-cocktail-maker/jobs/485488692)

---

<div class="post-metadata">

**Author:** ![Montana](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/montana/32/9566_2.png) [@Montana](https://travis-ci.community/u/Montana)\
**Post date:** [April 19, 2021, 7:14am UTC](https://travis-ci.community/t/encrypting-files-bad-decrypt/11202/2 "2021-04-19T07:14:14Z")

</div>

Hey @alex9849,

Can you try?

`travis encrypt-file -r OWNER/REPO file`

See if that makes a difference.

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [April 20, 2021, 7:46pm UTC](https://travis-ci.community/t/encrypting-files-bad-decrypt/11202/3 "2021-04-20T19:46:20Z")

</div>

> [@Custom deployment - Problem with SFTP key and cURL: "curl failed to verify the legitimacy of the server"](https://travis-ci.community/t/custom-deployment-problem-with-sftp-key-and-curl-curl-failed-to-verify-the-legitimacy-of-the-server/11248/15):
>
> A lot of thanks @native-api As you said in the linked post, I has an outdated version, so I only update the travis gem, re-encrypt the files and commit the changes.

> [@"bad decrypt" when there are multiple encrypted files](https://travis-ci.community/t/bad-decrypt-when-there-are-multiple-encrypted-files/7362/13):
>
> As per [Custom deployment - Problem with SFTP key and cURL: "curl failed to verify the legitimacy of the server" - #13 by aleks-rodriguez](https://travis-ci.community/t/custom-deployment-problem-with-sftp-key-and-curl-curl-failed-to-verify-the-legitimacy-of-the-server/11248/13), it looks like this problem resurfaces if one is using the same decryption key variables multiple times: $ openssl aes-zss-cbc -K Sencrypted\_9886as3a028f\_key -1v Sencrypted\_9806a53a028f\_1v -in ssh-pair.enc -out ssh-pair -d \<...\> $ openssl aes-zss-cbc -K Sencrypted\_9886asaad28f\_key -iv Sencrypted\_9806a533d28f\_iv -in id\_rsa.enc -out id\_rsa -d bad decrypt In t…
