summaryrefslogtreecommitdiff
path: root/dotfiles/common/.local/bin/encryptfile
blob: bfe5aeea1668e66fff714827c04e9dec50af6794 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
# Encrypt a file with symmetric GPG (password-based)
# Usage: encryptfile <file>

if [ -z "$1" ]; then
    echo "Usage: encryptfile <file>"
    exit 1
fi

if [ ! -f "$1" ]; then
    echo "File not found: $1"
    exit 1
fi

gpg --symmetric --cipher-algo AES256 --armor -o "${1}.gpg" "$1" && \
    echo "Encrypted to ${1}.gpg" && \
    rm -i "$1"