Encrypting a file

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.

Get Hands-On Continuous Integration and Delivery now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.