This repository has been archived on 2026-02-02. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
dotfiles/bin/decrypt

23 lines
402 B
Bash
Executable file

#!/bin/bash
KEY_KEY=~/.ssh/scott@wallace.sh
KEY=$(mktemp)
if [ -f "${1}.enc" ]; then
INPUT=${1}
else
echo "ERROR: Filenme not valid"
exit 1
fi
function cleanup() {
rm -f ${KEY}
}
trap cleanup EXIT
# Decrypr key
openssl rsautl -decrypt -inkey ${KEY_KEY} -out ${KEY} -in ${INPUT}.key
# Decrypt file
openssl enc -d -aes-256-cbc -salt -out ${INPUT} -in ${INPUT}.enc -pass file:${KEY}