1998-02-26 16:56:31 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
1998-09-14 10:33:57 +00:00
|
|
|
. $srcdir/defs.inc || exit 3
|
1998-02-26 16:56:31 +00:00
|
|
|
|
1998-09-28 19:25:31 +00:00
|
|
|
|
|
|
|
if which expect ; then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
echo "\"expect\" needed but not found - test skipped"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
1998-11-10 12:59:59 +00:00
|
|
|
LANG=
|
|
|
|
LANGUAGE=
|
1998-09-28 19:25:31 +00:00
|
|
|
|
1998-02-26 16:56:31 +00:00
|
|
|
expect - <<EOF
|
1998-08-11 17:29:34 +00:00
|
|
|
#set timeout -1
|
1998-09-28 19:25:31 +00:00
|
|
|
set timeout 8
|
1998-02-26 16:56:31 +00:00
|
|
|
match_max 100000
|
|
|
|
spawn ../g10/gpg --no-batch --quick-random --homedir . --gen-key
|
1998-12-10 19:20:47 +00:00
|
|
|
expect {
|
1998-08-11 17:29:34 +00:00
|
|
|
-exact "Please select what kind of key you want:\r
|
|
|
|
(1) DSA and ElGamal (default)\r
|
1998-12-10 19:20:47 +00:00
|
|
|
(2) DSA (sign only)\r
|
|
|
|
(4) ElGamal (sign and encrypt)\r
|
1998-08-11 17:29:34 +00:00
|
|
|
Your selection? " { send -- "1\r" }
|
|
|
|
timeout { exit 1 } }
|
|
|
|
expect {
|
|
|
|
-exact "1\r
|
1998-09-14 13:02:45 +00:00
|
|
|
\r \rDSA keypair will have 1024 bits.\r
|
1998-08-11 17:29:34 +00:00
|
|
|
About to generate a new ELG-E keypair.\r
|
1998-09-14 13:02:45 +00:00
|
|
|
minimum keysize is 768 bits\r
|
|
|
|
default keysize is 1024 bits\r
|
1998-02-26 16:56:31 +00:00
|
|
|
highest suggested keysize is 2048 bits\r
|
1998-08-11 17:29:34 +00:00
|
|
|
What keysize do you want? (1024) " { send -- "\r" }
|
|
|
|
timeout { exit 1 } }
|
|
|
|
expect {
|
|
|
|
-exact "\r
|
1998-09-14 13:02:45 +00:00
|
|
|
\r \rRequested keysize is 1024 bits\r
|
1998-08-11 17:29:34 +00:00
|
|
|
Please specify how long the key should be valid.\r
|
1998-09-14 13:02:45 +00:00
|
|
|
0 = key does not expire\r
|
1998-08-11 17:29:34 +00:00
|
|
|
<n> = key expires in n days\r
|
|
|
|
<n>w = key expires in n weeks\r
|
|
|
|
<n>m = key expires in n months\r
|
|
|
|
<n>y = key expires in n years\r
|
|
|
|
Key is valid for? (0) " { send -- "1\r" }
|
|
|
|
timeout { exit 1 } }
|
|
|
|
expect {
|
|
|
|
-exact "1\r
|
1998-09-14 13:02:45 +00:00
|
|
|
\r \rKey expires at " { }
|
1998-08-11 17:29:34 +00:00
|
|
|
timeout { exit 1 } }
|
1998-12-10 19:20:47 +00:00
|
|
|
expect {
|
1998-08-11 17:29:34 +00:00
|
|
|
-re "(.*)\r
|
|
|
|
" {}
|
|
|
|
timeout { exit 1 } }
|
|
|
|
expect {
|
|
|
|
-exact "Is this correct (y/n)? " { send -- "y\r" }
|
|
|
|
timeout { exit 1 } }
|
|
|
|
expect {
|
|
|
|
-exact "y\r
|
1998-09-14 13:02:45 +00:00
|
|
|
\r \r\r
|
1998-02-26 16:56:31 +00:00
|
|
|
You need a User-ID to identify your key; the software constructs the user id\r
|
|
|
|
from Real Name, Comment and Email Address in this form:\r
|
1998-08-11 17:29:34 +00:00
|
|
|
\"Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>\"\r
|
1998-02-26 16:56:31 +00:00
|
|
|
\r
|
1998-08-11 17:29:34 +00:00
|
|
|
Real name: " { send -- "Harry H.\r" }
|
|
|
|
timeout { exit 1 } }
|
|
|
|
expect {
|
|
|
|
-exact "Harry H.\r
|
1998-09-14 13:02:45 +00:00
|
|
|
\r \rEmail address: " { send -- "hh@ddorf.de\r" }
|
1998-08-11 17:29:34 +00:00
|
|
|
timeout { exit 1 } }
|
|
|
|
expect {
|
|
|
|
-exact "hh@ddorf.de\r
|
1998-09-14 13:02:45 +00:00
|
|
|
\r \rComment: " { send -- "a test\r" }
|
1998-08-11 17:29:34 +00:00
|
|
|
timeout { exit 1 } }
|
|
|
|
expect {
|
|
|
|
-exact "a test\r
|
1998-09-14 13:02:45 +00:00
|
|
|
\r \rYou selected this USER-ID:\r
|
1998-02-26 16:56:31 +00:00
|
|
|
\"Harry H. (a test) <hh@ddorf.de> (INSECURE!)\"\r
|
|
|
|
\r
|
1998-08-11 17:29:34 +00:00
|
|
|
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? " { send -- "o\r" }
|
|
|
|
timeout { exit 1 } }
|
|
|
|
expect {
|
|
|
|
-exact "o\r
|
1998-09-14 13:02:45 +00:00
|
|
|
\r \rYou need a Passphrase to protect your secret key.\r
|
1998-02-26 16:56:31 +00:00
|
|
|
\r
|
1998-11-10 12:59:59 +00:00
|
|
|
Enter passphrase: " { sleep 1; send -- "abc\r" }
|
1998-08-11 17:29:34 +00:00
|
|
|
timeout { exit 1 } }
|
|
|
|
expect {
|
1998-11-10 12:59:59 +00:00
|
|
|
-ex "\r \rRepeat passphrase: " { sleep 1; send -- "abc\r" }
|
1998-08-11 17:29:34 +00:00
|
|
|
timeout { exit 1 } }
|
1998-12-10 19:20:47 +00:00
|
|
|
expect {
|
1998-11-10 12:59:59 +00:00
|
|
|
-ex "\r \rWe need to generate a lot of random bytes. It is a good idea to perform\r
|
1998-08-11 17:29:34 +00:00
|
|
|
some other action (work in another window, move the mouse, utilize the\r
|
|
|
|
network and the disks) during the prime generation; this gives the random\r
|
|
|
|
number generator a better chance to gain enough entropy.\r" {}
|
|
|
|
timeout { exit 1 } }
|
1998-09-28 19:25:31 +00:00
|
|
|
set timeout 600
|
1998-08-11 17:29:34 +00:00
|
|
|
expect {
|
|
|
|
-ex "public and secret key created and signed.\r" { exit 0 }
|
|
|
|
eof { exit 1 }
|
1998-02-26 16:56:31 +00:00
|
|
|
}
|
1998-08-11 17:29:34 +00:00
|
|
|
exit 1
|
1998-02-26 16:56:31 +00:00
|
|
|
EOF
|
|
|
|
|
1998-12-10 19:20:47 +00:00
|
|
|
#*-*wedit:notab*-*
|