summaryrefslogtreecommitdiffstats
path: root/tests/openpgp/version.test
blob: ed0f6c449c6877ee3e713870565fd98c194e573f (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
# Copyright 1998,1999,2000,2001,2002,2003,2004,2005,2006,
#           2007 Free Software Foundation, Inc.
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.  This file is
# distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY, to the extent permitted by law; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

. $srcdir/defs.inc || exit 3

# This is the first test run by "make check".  First kill a possible
# gpg-agent process from a previous test run.
if $GPG_AGENT --quiet; then
    echo "$pgmname: killing leftover gpg-agent process" >&2
    $GPG_CONNECT_AGENT killagent /bye >/dev/null
    sleep 2
fi


info "Deleting old files"
if [ -f Makefile -a -f $srcdir/decrypt-dsa.test ]; then
  :
else
  fatal "not running in the test directory"
  exit 1
fi
if [ -d private-keys-v1.d ]; then
    rm private-keys-v1.d/* 2>/dev/null || true
    rmdir private-keys-v1.d 
fi
for i in pubring.gpg pubring.gpg~ trustdb.gpg trustdb.gpg~ ; do
  [ -d "$i" ] && rm "$i"
done

# Now start the agent right away, so that there is only one place
# where starting the agent may fail.  To speed up key generation we
# create a faked random seed file.  Note that we need to set the
# agent-program so that gpg-connect-agent is able to start the agent
# we are currently testing and not an already installed one.
info "Starting the agent"
$MKTDATA 600 >random_seed
if $GPG_CONNECT_AGENT -v --agent-program="$GPG_AGENT" /bye; then
    :
else
    error "starting the gpg-agent failed"
    exit 1
fi


info "Creating sample data files"
for i in 500 9000 32000 80000; do
    $MKTDATA  $i >data-$i
done
cat $srcdir/../../doc/HACKING \
    $srcdir/../../doc/DETAILS \
    $srcdir/../../doc/gpg.texi >plain-large

info "Unpacking samples"
$GPG --dearmor < $srcdir/plain-1o.asc > ./plain-1
$GPG --dearmor < $srcdir/plain-2o.asc > ./plain-2
$GPG --dearmor < $srcdir/plain-3o.asc > ./plain-3

info "Storing private keys"
for i in 50B2D4FA4122C212611048BC5FC31BD44393626E \
         7E201E28B6FEB2927B321F443205F4724EBE637E \
         13FDB8809B17C5547779F9D205C45F47CE0217CE \
         343D8AF79796EE107D645A2787A9D9252F924E6F \
         8B5ABF3EF9EB8D96B91A0B8C2C4401C91C834C34 \
         0D6F6AD4C4C803B25470F9104E9F4E6A4CA64255 \
         FD692BD59D6640A84C8422573D469F84F3B98E53 \
         76F7E2B35832976B50A27A282D9B87E44577EB66 \
         A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD ; do
   $GPG --dearmor < $srcdir/privkeys/$i.asc > private-keys-v1.d/$i.key
done

info "Importing public demo and test keys"
$GPG --yes --import $srcdir/pubdemo.asc $srcdir/pubring.asc
$GPG --dearmor < $srcdir/pubring.pkr.asc | $GPG --yes --import


info "Preset passphrases"
# one@example.com
$GPG_PRESET_PASSPHRASE --preset -P def 50B2D4FA4122C212611048BC5FC31BD44393626E
$GPG_PRESET_PASSPHRASE --preset -P def 7E201E28B6FEB2927B321F443205F4724EBE637E
# alpha@example.net
$GPG_PRESET_PASSPHRASE --preset -P abc 76F7E2B35832976B50A27A282D9B87E44577EB66
$GPG_PRESET_PASSPHRASE --preset -P abc A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD


# Note: secring.asc and secring.skr.asc are the original secrings for
# our test files.  We don't support this as storage format anymore but
# keep the files here for reference.  The actual keys have been
# extracted and put in gpg-agent's format unter privkeys/.  Because
# the current gpg's import feature does not support storing of
# unprotected keys in the new gpg-agent format, we had to resort to
# some trickery to convert them.


info "Printing the GPG version"
$GPG --version

#fixme: check that the output is as expected