The encrypt-file command will encrypt an entire file using symmetric (AES-256) encryption and stores the secret in a file. Let us create a file called secret.txt and add the following entries into it:
SECRET_VALUE=ABCDE12345CLIENT_ID=rocky123CLIENT_SECRET=abc222222!
Now let us encrypt our secret file:
So now we will add this entry into our .travis.yml script:
before_install: - openssl aes-256-cbc -K $encrypted_74945c17fbe2_key -iv $encrypted_74945c17fbe2_iv -in secret.txt.enc -out secret.txt -d
It can then decrypt the values in the secret text file for us.