-
Notifications
You must be signed in to change notification settings - Fork 1
/
pub2txt
56 lines (39 loc) · 1.39 KB
/
pub2txt
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#/usr/bin/bash
# This script will export your public key to a text file so you can share it with others.
clear;
# Prompt user for the directory where the exported public key text file will be written to.
outputDirectory=$(zenity \
--title="Select the directory where the exported public key text file will be written" \
--file-selection \
--filename="/home/pi/" \
--directory \
2>/dev/null);
# If the user cancels the prompt action then exit this script.
if [ $? == 1 ]; then exit; fi
clear;
# Prompt user to specify the name for the exported public key text file.
outputFileName=$(zenity \
--entry \
--title="Specify the name for the exported public key text file" \
--entry-text="publickeyexport.txt" \
--width 600 \
2>/dev/null);
# If the user cancels the prompt action then exit this script.
if [ $? == 1 ]; then exit; fi
clear;
# Prompt user for the email address or unique id of the public key.
uniqueID=$(zenity \
--entry \
--title="Specify the email address or uniqueID of the public key" \
--entry-text="UniqueID or Email Address" \
--width 600 \
2>/dev/null);
# If the user cancels the prompt action then exit this script.
if [ $? == 1 ]; then exit; fi
cd $outputDirectory;
outputPathAndFileName=$outputDirectory/$outputFileName;
gpg --export --armor $uniqueID > $outputPathAndFileName;
clear;
echo "Public key was exported to "$outputPathAndFileName
echo "Press the ENTER key to continue";
read;