aboutsummaryrefslogtreecommitdiff
path: root/bin/gpg-check
blob: 79948c9eb8c180b51a916ad7ac0a004df5500277 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh

MSG=$(cat)

echo "${MSG}" | grep 'BEGIN PGP SIGNATURE' > /dev/null 2>&1;
SIGNED=$?

if [ ${SIGNED} = 0 ]; then
    echo "${MSG}" | \
        sed -e '/^-\+BEGIN PGP SIGNED MESSAGE-\+/,/^Hash:.*/d' \
            -e '/^-\+BEGIN PGP SIGNATURE-\+/,$d' | \
        mutt-autoalias
    echo '\n'
    echo "${MSG}" | gpg --verify - 2>&1;
else
    echo "${MSG}" | mutt-autoalias
fi