Skip to content

Instantly share code, notes, and snippets.

@scarolan
Created October 18, 2018 18:33
Show Gist options
  • Save scarolan/9f01b7011ccd59ea93bf76f7e31b2884 to your computer and use it in GitHub Desktop.
Save scarolan/9f01b7011ccd59ea93bf76f7e31b2884 to your computer and use it in GitHub Desktop.
function vencrypt() {
INPUTFILE=$1
vault write -format=json transit/encrypt/my-key plaintext=@<(base64 -i $INPUTFILE) | jq -r '.data|.ciphertext'
}
function vdecrypt() {
INPUTFILE=$1
vault write -format=json transit/decrypt/my-key ciphertext=$(cat $INPUTFILE ) | jq -r '.data|.plaintext' | base64 -i -d
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment