summaryrefslogtreecommitdiffstats
path: root/checks/genkey1024.test
blob: e419088f2b643e6cbaeeb9c1fe380bc63351ffb6 (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
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/sh

. $srcdir/defs.inc || exit 3


if which expect ; then
  :
else
  echo "\"expect\" needed but not found - test skipped"
  exit 0
fi



expect - <<EOF
#set timeout -1
set timeout 8
match_max 100000
spawn ../g10/gpg --no-batch --quick-random --homedir . --gen-key
expect { 
    -exact "Please select what kind of key you want:\r
   (1) DSA and ElGamal (default)\r
   (2) ElGamal (sign and encrypt)\r
   (3) ElGamal (encrypt only)\r
   (4) DSA (sign only)\r
   (5) ElGamal in a v3 packet\r
Your selection? "  { send -- "1\r" }
    timeout { exit 1 } }
expect {
    -exact "1\r
\r                 \rDSA keypair will have 1024 bits.\r
About to generate a new ELG-E keypair.\r
              minimum keysize is  768 bits\r
              default keysize is 1024 bits\r
    highest suggested keysize is 2048 bits\r
What keysize do you want? (1024) " { send -- "\r" }
    timeout { exit 1 } }
expect {
    -exact "\r
\r                                 \rRequested keysize is 1024 bits\r
Please specify how long the key should be valid.\r
         0 = key does not expire\r
      <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
\r                       \rKey expires at " { }
    timeout { exit 1 } }
expect { 
     -re "(.*)\r
" {}
    timeout { exit 1 } }
expect {
    -exact "Is this correct (y/n)? " { send -- "y\r" }
    timeout { exit 1 } }
expect {
    -exact "y\r
\r                        \r\r
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
    \"Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>\"\r
\r
Real name: " { send -- "Harry H.\r" }
    timeout { exit 1 } }
expect {
   -exact "Harry H.\r
\r                   \rEmail address: " { send -- "hh@ddorf.de\r" }
    timeout { exit 1 } }
expect {
   -exact "hh@ddorf.de\r
\r                          \rComment: " { send -- "a test\r" }
    timeout { exit 1 } }
expect {
   -exact "a test\r
\r               \rYou selected this USER-ID:\r
    \"Harry H. (a test) <hh@ddorf.de> (INSECURE!)\"\r
\r
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? " { send -- "o\r" }
    timeout { exit 1 } }
expect {
   -exact "o\r
\r                                                     \rYou need a Passphrase to protect your secret key.\r
\r
Enter pass phrase: " { sleep 1; send -- "abc\r" }
    timeout { exit 1 } }
expect {
  -ex "\r                   \rRepeat pass phrase: " { sleep 1; send -- "abc\r" }
    timeout { exit 1 } }
expect { 
  -ex "\r                    \rWe need to generate a lot of random bytes. It is a good idea to perform\r
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 } }
set timeout 600
expect {
    -ex "public and secret key created and signed.\r" { exit 0 }
    eof  { exit 1 }
}
exit 1
EOF