File: release_util_script_encrypt_var.sh

package info (click to toggle)
cbmc 6.6.0-4
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 153,852 kB
  • sloc: cpp: 386,459; ansic: 114,466; java: 28,405; python: 6,003; yacc: 4,552; makefile: 4,041; lex: 2,487; xml: 2,388; sh: 2,050; perl: 557; pascal: 184; javascript: 163; ada: 36
file content (18 lines) | stat: -rwxr-xr-x 766 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
# --------------------------------------------------------------------------------
# This script can be used to encrypt a variable (e.g. gpg key id, if a key is
# provided by someone else)
# NB release_util_script_create_gpg provides both the key id and also its
# encrypted form.
# This script is the peer of 'release_util_script_decrypt_var.sh' - which can be used to
# double check that an encrypted variable (e.g. gpg key id) is correct (e.g. no
# misspellings have occurred).
# --------------------------------------------------------------------------------
set -euo pipefail

SSL_PWD="$1"
VAR="$2"

echo "encrypted var is:"
VAR_ENC=$(echo "${VAR}" | openssl aes-256-cbc -a -salt -pass pass:"${SSL_PWD}" | openssl enc -A -base64)
echo "${VAR_ENC}"