Show gpg key

This commit is contained in:
Bob Mottram 2016-02-27 10:58:30 +00:00
parent 3ed167a3cf
commit 63a114ec70
1 changed files with 59 additions and 5 deletions

View File

@ -344,6 +344,58 @@ function block_unblock_subject {
fi
}
function show_gpg_key {
MY_EMAIL_ADDRESS=$USER@$HOSTNAME
GPG_ID=$(gpg --fingerprint $MY_EMAIL_ADDRESS | grep -i "pub" | head -n 1 | awk -F '/' '{print $2}' | awk -F ' ' '{print $1}')
GPG_FINGERPRINT=$(gpg --fingerprint $MY_EMAIL_ADDRESS | grep -i "key fingerprint" | head -n 1 | awk -F '= ' '{print $2}')
GPG_DATE=$(gpg --fingerprint $MY_EMAIL_ADDRESS | grep -i "pub" | head -n 1 | awk -F '/' '{print $2}' | awk -F ' ' '{print $2}')
dialog --title $"Your PGP/GPG Key" \
--backtitle $"Freedombone User Control Panel" \
--msgbox "Email Address: $MY_EMAIL_ADDRESS\n\nKey ID: $GPG_ID\n\nFingerprint: $GPG_FINGERPRINT\n\nCreated: $GPG_DATE" 12 70
}
function add_gpg_key {
}
function remove_gpg_key {
}
function add_ssh_key {
}
function remove_ssh_key {
}
function menu_encryption_keys {
while true
do
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone User Control Panel" \
--title $"Your Encryption Keys" \
--radiolist $"Choose an operation:" 14 70 6 \
1 $"Show your PGP/GPG key" off \
2 $"Add someone's PGP/GPG key" off \
3 $"Remove someone's PGP/GPG key" off \
4 $"Add an ssh key for logging in" off \
5 $"Remove an ssh key for logging in" off \
6 $"Back to main menu" on 2> $data
sel=$?
case $sel in
1) break;;
255) break;;
esac
case $(cat $data) in
1) show_gpg_key;;
2) add_gpg_key;;
3) remove_gpg_key;;
4) add_ssh_key;;
5) remove_ssh_key;;
6) break;;
esac
done
}
function menu_email {
while true
do
@ -384,13 +436,14 @@ function menu_top_level {
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone User Control Panel" \
--title $"User Control Panel" \
--radiolist $"Choose an operation:" 13 50 6 \
--radiolist $"Choose an operation:" 14 50 7 \
1 $"Use Email" off \
2 $"Change Email Filtering Rules" off \
3 $"Use Chat" off \
4 $"Use IRC" off \
5 $"Exit to the command line" off \
6 $"Log out" on 2> $data
5 $"Your Encryption Keys" off \
6 $"Exit to the command line" off \
7 $"Log out" on 2> $data
sel=$?
case $sel in
1) exit 1;;
@ -401,8 +454,9 @@ function menu_top_level {
2) menu_email;;
3) toxic;;
4) irssi;;
5) break;;
6) kill -HUP `pgrep -s 0 -o`;;
5) menu_encryption_keys;;
6) break;;
7) kill -HUP `pgrep -s 0 -o`;;
esac
done
}