简体   繁体   中英

Working with encrypted data in travis

I've made a web-service and I'm working with sensitive data that I want to encrypt (a yandel key). I have this data in the path src/main/resources/application.properties with the content yandex.api_key=valueOfMyKey .

I execute the command travis encrypt-file application.properties and get the file encoded application.properties.enc . In addition, I get this output, and I realize what it's said (I add the build script to my .travis.yml )

storing secure env variables for decryption
Please add the following to your build script (before_install stage in your .travis.yml, for instance):

openssl aes-256-cbc -K $encrypted_b21eaa919621_key -iv $encrypted_b21eaa919621_iv -in application.properties.enc -out application.properties -d

Pro Tip: You can add it automatically by running with --add.

Make sure to add application.properties.enc to the git repository.
Make sure not to add application.properties to the git repository.
Commit all changes to your .travis.yml.

I execute the command travis lint .travis.yml and I get a valid output. My travis file has now this content:

language: java
jdk:
- oraclejdk8
before_install:
- openssl aes-256-cbc -K $encrypted_b21eaa919621_key -iv $encrypted_b21eaa919621_iv
  -in src/main/resources/application.properties.enc -out src/main/resources/application.properties -d

However, I don't pass the travis test. I get the following output:

在此处输入图片说明

You can check my code in this public repo .

I solved it. I didn't activate travis before the encrypt of my file, so travis didn't have both values. I just activated it and did the encrypt again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM