Page History
...
- Download: JS7 - Download (Section: Utililties, Unix:
js7.encryption.tar.gz
, Windows:js7.encryption.zip
), - The solution is available
- for Linux, MacOS®, AIX® using bash, zsh, dash shell
- as explained with this article,
- for Windows® Shell, see JS7 - How to encrypt and decrypt using Windows Shell,
- for Linux, MacOS®, Windows® from JS7 - How to encrypt and decrypt using PowerShell.
- Encryption and decryption with Unix and Windows can be used interchangeably.
...
Code Block | ||||
---|---|---|---|---|
| ||||
result=$(./bin/js7_encrypt.sh --cert=agent.crt --in="secret") echo "${result}$result" # encrypts the given secret using an Agent's X.509 certificate # output includes the symmetric key, initialization vector and encrypted string separated by space |
...
Code Block | ||||
---|---|---|---|---|
| ||||
result=$(./bin/js7_encrypt.sh --cert=agent.crt --in="secret") echo "result=${result}new_var=$result" >> $JS7_RETURN_VALUES # encrypts the given secret using an Agent's X.509 certificate # output includes the symmetric key, initialization vector and encrypted string separated by spaces # output is stored to the "resultnew_var" variable (key/value pair) that is made available for later jobs in the workflow |
...
Code Block | ||||
---|---|---|---|---|
| ||||
echo "secret file" > /tmp/secret.txt result=$(./bin/js7_encrypt.sh --cert=agent.crt --infile=/tmp/secret.txt --outfile=/tmp/secret.txt.encrypted) echo "${result}$result" # encrypts the given file using an Agent's X.509 certificate and creates an encrypted output file # output includes the symmetric key, initialization vector and path to encrypted file separated by spaces |
...
Code Block | ||||
---|---|---|---|---|
| ||||
# assumes that previous encryption created the "result" variable # result=$(./bin/js7_encrypt.sh --cert=agent.crt --in="secret") secret=$(./bin/js7_decrypt.sh \ --key=agent.key \ --key-password="jobscheduler" \ --encrypted-key="$(echo "${result}$result" | cut -d' ' -f 1)" \ --iv="$(echo "${result}$result" | cut -d' ' -f 2)" \ --in="$(echo "${result}$result" | cut -d' ' -f 3)") echo "${secret}" # decrypts the given encrypted secret using an Agent's private key and passphrace # initialization vector, encrypted symmetric key and encrypted secret are returned during encryption # output includes the decrypted secret |
...
Code Block | ||||
---|---|---|---|---|
| ||||
# assumes that previous encryption created the "result" variable
# result=$(./bin/js7_encrypt.sh --cert=agent.crt --infile=/tmp/secret.txt --outfile=/tmp/secret.txt.encrypted)
./bin/js7_decrypt.sh \
--key=agent.key \
--key-password="jobscheduler" \
--encrypted-key="$(echo "${result}" | cut -d' ' -f 1)" \
--iv="$(echo "${result}" | cut -d' ' -f 2)" \
--infile=$(echo "${result}" | cut -d' ' -f 3) \
--outfile=/tmp/secret.txt.decrypted
cat /tmp/secret.txt.decrypted
# decrypts the given encrypted file using an Agent's private key and passphrase
# creates the decrypted output file |
...
Overview
Content Tools