Browse Source

Show gpg key

Bob Mottram 9 years ago
parent
commit
63a114ec70
1 changed files with 59 additions and 5 deletions
  1. 59
    5
      src/freedombone-controlpanel-user

+ 59
- 5
src/freedombone-controlpanel-user View File

@@ -344,6 +344,58 @@ function block_unblock_subject {
344 344
     fi
345 345
 }
346 346
 
347
+function show_gpg_key {
348
+    MY_EMAIL_ADDRESS=$USER@$HOSTNAME
349
+    GPG_ID=$(gpg --fingerprint $MY_EMAIL_ADDRESS | grep -i "pub" | head -n 1 | awk -F '/' '{print $2}' | awk -F ' ' '{print $1}')
350
+    GPG_FINGERPRINT=$(gpg --fingerprint $MY_EMAIL_ADDRESS | grep -i "key fingerprint" | head -n 1 | awk -F '= ' '{print $2}')
351
+    GPG_DATE=$(gpg --fingerprint $MY_EMAIL_ADDRESS | grep -i "pub" | head -n 1 | awk -F '/' '{print $2}' | awk -F ' ' '{print $2}')
352
+    dialog --title $"Your PGP/GPG Key" \
353
+           --backtitle $"Freedombone User Control Panel" \
354
+           --msgbox "Email Address: $MY_EMAIL_ADDRESS\n\nKey ID: $GPG_ID\n\nFingerprint: $GPG_FINGERPRINT\n\nCreated: $GPG_DATE" 12 70
355
+}
356
+
357
+function add_gpg_key {
358
+}
359
+
360
+function remove_gpg_key {
361
+}
362
+
363
+function add_ssh_key {
364
+}
365
+
366
+function remove_ssh_key {
367
+}
368
+
369
+function menu_encryption_keys {
370
+    while true
371
+    do
372
+        data=$(tempfile 2>/dev/null)
373
+        trap "rm -f $data" 0 1 2 5 15
374
+        dialog --backtitle $"Freedombone User Control Panel" \
375
+               --title $"Your Encryption Keys" \
376
+               --radiolist $"Choose an operation:" 14 70 6 \
377
+               1 $"Show your PGP/GPG key" off \
378
+               2 $"Add someone's PGP/GPG key" off \
379
+               3 $"Remove someone's PGP/GPG key" off \
380
+               4 $"Add an ssh key for logging in" off \
381
+               5 $"Remove an ssh key for logging in" off \
382
+               6 $"Back to main menu" on 2> $data
383
+        sel=$?
384
+        case $sel in
385
+            1) break;;
386
+            255) break;;
387
+        esac
388
+        case $(cat $data) in
389
+            1) show_gpg_key;;
390
+            2) add_gpg_key;;
391
+            3) remove_gpg_key;;
392
+            4) add_ssh_key;;
393
+            5) remove_ssh_key;;
394
+            6) break;;
395
+        esac
396
+    done
397
+}
398
+
347 399
 function menu_email {
348 400
     while true
349 401
     do
@@ -384,13 +436,14 @@ function menu_top_level {
384 436
         trap "rm -f $data" 0 1 2 5 15
385 437
         dialog --backtitle $"Freedombone User Control Panel" \
386 438
                --title $"User Control Panel" \
387
-               --radiolist $"Choose an operation:" 13 50 6 \
439
+               --radiolist $"Choose an operation:" 14 50 7 \
388 440
                1 $"Use Email" off \
389 441
                2 $"Change Email Filtering Rules" off \
390 442
                3 $"Use Chat" off \
391 443
                4 $"Use IRC" off \
392
-               5 $"Exit to the command line" off \
393
-               6 $"Log out" on 2> $data
444
+               5 $"Your Encryption Keys" off \
445
+               6 $"Exit to the command line" off \
446
+               7 $"Log out" on 2> $data
394 447
         sel=$?
395 448
         case $sel in
396 449
             1) exit 1;;
@@ -401,8 +454,9 @@ function menu_top_level {
401 454
             2) menu_email;;
402 455
             3) toxic;;
403 456
             4) irssi;;
404
-            5) break;;
405
-            6) kill -HUP `pgrep -s 0 -o`;;
457
+            5) menu_encryption_keys;;
458
+            6) break;;
459
+            7) kill -HUP `pgrep -s 0 -o`;;
406 460
         esac
407 461
     done
408 462
 }