summaryrefslogtreecommitdiffstats
path: root/kmail/kmail-3.3-split-sign-encr-keys.sh
blob: 87c7a38970809c1a333f0aba65b01f30ed0f0ba9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#! /usr/bin/env bash

function delete_this_key() {
    echo "# DELETE [$GROUP]$KEY"
}

while read; do
    # Currently unused
    if [ "${REPLY#\[}" != "$REPLY" ] ; then # group name
	GROUP="${REPLY:1:${#REPLY}-2}"
	continue;
    fi
    # normal key=value pair:
    KEY="${REPLY%%=*}"
    VALUE="${REPLY#*=}"

    case "$GROUP" in
	Identity*)
	    echo "# got Identity Key \"$KEY\""
	    case "$KEY" in
		"Default PGP Key")
		    echo "[$GROUP]"
            echo "PGP Signing Key=$VALUE"
		    echo "[$GROUP]"
            echo "PGP Encryption Key=$VALUE"
		    delete_this_key
		    ;;
	    esac
	    ;;
    esac
done