4 # apt-key is a shell script, so relatively prune to be effected by 'crazy' things:
5 # confuses config parser as there exists no way of escaping " currently.
6 #TMPDIR="$(mktemp -d)/This is \"fü\$\$ing cràzy\", \$(man man | head -n1 | cut -d' ' -f 1)\$!"
7 # gpg doesn't like | in path names – documented e.g. in the man gpg2 --agent-program
8 #TMPDIR="$(mktemp -d)/This is fü\$\$ing cràzy, \$(man man | head -n1 | cut -d' ' -f 1)\$!"
9 TMPDIR_ADD
="This is fü\$\$ing cràzy, \$(apt -v)\$!"
11 TESTDIR
="$(readlink -f "$(dirname "$0")")"
12 . "$TESTDIR/framework
"
15 configarchitecture 'amd64'
17 # start from a clean plate again
19 rm -rf "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/" "${ROOTDIR}/etc
/apt
/trusted.gpg
"
20 mkdir "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/"
23 testfailure --nomsg aptkey --quiet --readonly "$@
"
24 testsuccess grep "^gpgv
: Can
't check signature" "${ROOTDIR}/tmp/testfailure.output"
25 testsuccess grep '^gpgv
: Good signature from
' "${ROOTDIR}/tmp/testfailure.output"
27 testaptkeyskeyring() {
30 local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/aptkeylistkeyring.output"
31 if ! aptkey --keyring "$KEYRING" list --with-colon | grep '^pub
' | cut -d':' -f 5 > "$OUTPUT"; then
34 testfileequal "$OUTPUT" "$(mapkeynametokeyid "$@")"
39 echo "APT::Key::ArchiveKeyring \"${KEYDIR}/joesixpack.pub.gpg\";
40 APT::Key::RemovedKeys \"${KEYDIR}/rexexpired.pub.gpg\";" > "${ROOTDIR}/etc/apt/apt.conf.d/aptkey.conf"
43 ln -sf "$(readlink -f "${KEYDIR}/joesixpack.pub.${EXT}")" "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.${EXT}"
44 testaptkeys 'Joe Sixpack
'
46 testsuccess aptkey list
47 msgtest 'Check that paths
in list output are not
' 'double
-slashed'
48 testfailure --nomsg grep '//' "${ROOTDIR}/tmp/testsuccess.output"
50 testsuccess aptkey finger
51 msgtest 'Check that paths
in finger output are not
' 'double
-slashed'
52 testfailure --nomsg grep '//' "${ROOTDIR}/tmp/testsuccess.output"
54 cp -a "${KEYDIR}/joesixpack.pub.${EXT}" "${KEYDIR}/joesixpack.pub.${EXT}.bak"
55 testequalor2 'gpg
: key DBAC8DAE
: "Joe Sixpack (APT Testcases Dummy) <joe@example.org>" not changed
56 gpg
: Total number processed
: 1
57 gpg
: unchanged
: 1' 'gpg
: key
5A90D141DBAC8DAE
: "Joe Sixpack (APT Testcases Dummy) <joe@example.org>" not changed
58 gpg
: Total number processed
: 1
59 gpg
: unchanged
: 1' aptkey --fakeroot update
60 testsuccess test -L "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.${EXT}"
61 testsuccess cmp "${KEYDIR}/joesixpack.pub.${EXT}" "${KEYDIR}/joesixpack.pub.${EXT}.bak"
63 testaptkeys 'Joe Sixpack
'
64 testfailure test -e "${ROOTDIR}/etc/apt/trusted.gpg"
66 testsuccess aptkey --fakeroot add "${KEYDIR}/rexexpired.pub.${EXT}"
67 testfilestats "${ROOTDIR}/etc/apt/trusted.gpg" '%a
' '=' '644'
69 testaptkeys 'Rex Expired
' 'Joe Sixpack
'
71 msgtest 'Check that Sixpack key can be
' 'exported
'
72 aptkey export 'Sixpack
' > "${TMPWORKINGDIRECTORY}/aptkey.export"
73 aptkey --keyring "${ROOTDIR}/etc/apt/trusted.gpg.d/joesixpack.${EXT}" exportall > "${TMPWORKINGDIRECTORY}/aptkey.exportall"
74 testsuccess --nomsg cmp "${TMPWORKINGDIRECTORY}/aptkey.export" "${TMPWORKINGDIRECTORY}/aptkey.exportall"
75 testsuccess test -s "${TMPWORKINGDIRECTORY}/aptkey.export"
76 testsuccess test -s "${TMPWORKINGDIRECTORY}/aptkey.exportall"
78 msgtest 'Execute update again to trigger removal of
' 'Rex Expired key
'
79 testsuccess --nomsg aptkey --fakeroot update
81 testaptkeys 'Joe Sixpack
'
83 msgtest "Try to remove a key which exists, but isn't
in the
" 'forced keyring'
84 testsuccess --nomsg aptkey --fakeroot --keyring "${ROOTDIR}/etc
/apt
/trusted.gpg
" del DBAC8DAE
86 testaptkeys 'Joe Sixpack'
88 testsuccess aptkey --fakeroot del DBAC8DAE
91 ln -sf "$(readlink -f "${KEYDIR}/joesixpack.pub.${EXT}")" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}"
92 testaptkeys 'Joe Sixpack'
93 msgtest "Remove a key from
" 'forced keyring in trusted.d.gpg'
94 testsuccess --nomsg aptkey --fakeroot --keyring "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}" del DBAC8DAE
95 testsuccess cmp -s "$(readlink -f "${KEYDIR}/joesixpack.pub.${EXT}")" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}~
"
98 cp -a "${KEYDIR}/marvinparanoid.pub.asc
" "${ROOTDIR}/etc
/foobar.pub
"
99 testsuccess aptkey --fakeroot --keyring "${ROOTDIR}/etc
/foobar.pub
" add "${KEYDIR}/rexexpired.pub.asc
" "${KEYDIR}/joesixpack.pub.gpg
"
100 testfilestats "${ROOTDIR}/etc
/foobar.pub
" '%a' '=' '644'
101 testaptkeyskeyring "${ROOTDIR}/etc
/foobar.pub
" 'Marvin Paranoid' 'Rex Expired' 'Joe Sixpack'
102 testempty aptkey list
104 msgtest 'Test key removal with' 'lowercase key ID' #keylength somewhere between 8byte and short
106 cp -a "${KEYDIR}/joesixpack.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}"
107 testsuccess --nomsg aptkey --fakeroot del d141dbac8dae
108 testempty aptkey list
110 if [ "$(id -u)" != '0' ]; then
111 msgtest 'Test key removal with' 'unreadable key'
113 cp -a "${KEYDIR}/joesixpack.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}"
114 echo 'foobar' > "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/unreadablekey.
${EXT}"
115 chmod 000 "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/unreadablekey.
${EXT}"
116 testwarning --nomsg aptkey --fakeroot del d141dbac8dae
117 testwarning aptkey list
118 chmod 644 "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/unreadablekey.
${EXT}"
119 rm -f "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/unreadablekey.
${EXT}"
120 grep -v '^W: ' "${ROOTDIR}/tmp
/testwarning.output
" > "${ROOTDIR}/aptkeylist.output
" || true
121 testempty cat "${ROOTDIR}/aptkeylist.output
"
124 msgtest 'Test key removal with' 'single key in real file'
126 cp -a "${KEYDIR}/joesixpack.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}"
127 testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
128 testempty aptkey list
129 testfailure test -e "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}"
130 testsuccess cmp "${KEYDIR}/joesixpack.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}~
"
132 msgtest 'Test key removal with' 'different key specs'
134 cp -a "${KEYDIR}/joesixpack.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}"
135 cp -a "${KEYDIR}/marvinparanoid.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/marvinparanoid.
${EXT}"
136 testsuccess --nomsg aptkey --fakeroot del 0xDBAC8DAE 528144E2
137 testempty aptkey list
138 testfailure test -e "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}"
139 testsuccess cmp "${KEYDIR}/joesixpack.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}~
"
140 testfailure test -e "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/marvinparanoid.
${EXT}"
141 testsuccess cmp "${KEYDIR}/marvinparanoid.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/marvinparanoid.
${EXT}~
"
143 msgtest 'Test key removal with' 'long key ID'
145 cp -a "${KEYDIR}/joesixpack.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}"
146 testsuccess --nomsg aptkey --fakeroot del 5A90D141DBAC8DAE
147 testempty aptkey list
148 testfailure test -e "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}"
149 testsuccess cmp "${KEYDIR}/joesixpack.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}~
"
151 msgtest 'Test key removal with' 'fingerprint'
153 cp -a "${KEYDIR}/joesixpack.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}"
154 testsuccess --nomsg aptkey --fakeroot del 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE
155 testempty aptkey list
156 testfailure test -e "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}"
157 testsuccess cmp "${KEYDIR}/joesixpack.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}~
"
159 msgtest 'Test key removal with' 'spaced fingerprint'
161 cp -a "${KEYDIR}/joesixpack.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}"
162 testsuccess --nomsg aptkey --fakeroot del '34A8 E9D1 8DB3 20F3 67E8 EAA0 5A90 D141 DBAC 8DAE'
163 testempty aptkey list
164 testfailure test -e "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}"
165 testsuccess cmp "${KEYDIR}/joesixpack.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}~
"
167 msgtest 'Test key removal with' 'single key in softlink'
169 ln -sf "$(readlink -f "${KEYDIR}/joesixpack.pub.${EXT}")" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}"
170 testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
171 testempty aptkey list
172 testfailure test -e "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}"
173 testsuccess test -L "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}~
"
176 testsuccess aptkey --fakeroot add "${KEYDIR}/joesixpack.pub.
${EXT}"
177 ln -sf "$(readlink -f "${KEYDIR}/marvinparanoid.pub.${EXT}")" "${KEYDIR}/marvin paránöid.pub.
${EXT}"
178 testsuccess aptkey --fakeroot add "${KEYDIR}/marvin paránöid.pub.
${EXT}"
179 testaptkeys 'Joe Sixpack' 'Marvin Paranoid'
180 cp -a "${ROOTDIR}/etc
/apt
/trusted.gpg
" "${KEYDIR}/testcase
-multikey.pub.gpg
" # store for reuse
181 gpg --no-default-keyring --keyring "${KEYDIR}/testcase
-multikey.pub.gpg
" --armor --export > "${KEYDIR}/testcase
-multikey.pub.asc
"
183 msgtest 'Test key removal with' 'multi key in real file'
185 cp -a "${KEYDIR}/testcase
-multikey.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/multikey.
${EXT}"
186 testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
187 testaptkeys 'Marvin Paranoid'
188 testsuccess cmp "${KEYDIR}/testcase
-multikey.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/multikey.
${EXT}~
"
190 msgtest 'Test key removal with' 'multi key in softlink'
192 ln -s "$(readlink -f "${KEYDIR}/testcase-multikey.pub.${EXT}")" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/multikey.
${EXT}"
193 testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
194 testaptkeys 'Marvin Paranoid'
195 testsuccess cmp "${KEYDIR}/testcase
-multikey.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/multikey.
${EXT}~
"
196 testfailure test -L "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/multikey.
${EXT}"
197 testsuccess test -L "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/multikey.
${EXT}~
"
199 msgtest 'Test key removal with' 'multiple files including key'
201 cp -a "${KEYDIR}/joesixpack.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}"
202 cp -a "${KEYDIR}/testcase
-multikey.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/multikey.
${EXT}"
203 testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
204 testaptkeys 'Marvin Paranoid'
205 testfailure test -e "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}"
206 testsuccess cmp "${KEYDIR}/joesixpack.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}~
"
207 testsuccess cmp "${KEYDIR}/testcase
-multikey.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/multikey.
${EXT}~
"
210 cp -a "${KEYDIR}/joesixpack.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}"
211 cp -a "${KEYDIR}/testcase
-multikey.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/multikey.
${EXT}"
212 testaptkeys 'Joe Sixpack' 'Joe Sixpack' 'Marvin Paranoid'
213 msgtest 'Test merge-back of' 'added keys'
214 testsuccess --nomsg aptkey adv --batch --yes --import "${KEYDIR}/rexexpired.pub.
${EXT}"
215 testaptkeys 'Rex Expired' 'Joe Sixpack' 'Joe Sixpack' 'Marvin Paranoid'
217 msgtest 'Test merge-back of' 'removed keys'
218 testsuccess --nomsg aptkey adv --batch --yes --delete-keys 27CE74F9
219 testaptkeys 'Joe Sixpack' 'Joe Sixpack' 'Marvin Paranoid'
221 msgtest 'Test merge-back of' 'removed duplicate keys'
222 testsuccess --nomsg aptkey adv --batch --yes --delete-keys DBAC8DAE
223 testaptkeys 'Marvin Paranoid'
226 cp -a "${KEYDIR}/joesixpack.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/joesixpack.
${EXT}"
227 cp -a "${KEYDIR}/testcase
-multikey.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/multikey.
${EXT}"
228 local SIGNATURE="${TMPWORKINGDIRECTORY}/signature
"
229 msgtest 'Test signing a file' 'with a key'
230 echo 'Verify me. This is my signature.' > "$SIGNATURE"
231 echo 'lalalalala' > "${SIGNATURE}2"
232 testsuccess --nomsg aptkey --quiet --keyring "${KEYDIR}/marvinparanoid.pub.gpg
" --secret-keyring "${KEYDIR}/marvinparanoid.sec
" --readonly \
233 adv --batch --yes --default-key 'Marvin' --armor --detach-sign --sign --output "${SIGNATURE}.gpg
" "${SIGNATURE}"
234 testsuccess test -s "${SIGNATURE}.gpg
" -a -s "${SIGNATURE}"
236 msgtest 'Test verify a file' 'with no sig'
237 testfailure --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/testcase
-multikey.pub.
${EXT}" verify "${SIGNATURE}" "${SIGNATURE}2"
239 for GPGV in '' 'gpgv' 'gpgv1' 'gpgv2'; do
240 echo "APT
::Key
::GPGVCommand
\"$GPGV\";" > "${ROOTDIR}/etc
/apt
/apt.conf.d
/00gpgvcmd
"
241 if [ -n "$GPGV" ] && ! command dpkg -l gnupg1 2>&1 | grep -q '^ii'; then continue; fi
243 msgtest 'Test verify a file' 'with all keys'
244 testsuccess --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg
" "${SIGNATURE}"
246 if [ "$(id -u)" != '0' ]; then
247 msgtest 'Test verify a file' 'with unreadable key'
248 echo 'foobar' > "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/unreadablekey.
${EXT}"
249 chmod 000 "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/unreadablekey.
${EXT}"
250 testwarning --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg
" "${SIGNATURE}"
251 testwarning aptkey list
252 chmod 644 "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/unreadablekey.
${EXT}"
253 rm -f "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/unreadablekey.
${EXT}"
256 msgtest 'Test verify a file' 'with good keyring'
257 testsuccess --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/testcase
-multikey.pub.
${EXT}" verify "${SIGNATURE}.gpg
" "${SIGNATURE}"
259 msgtest 'Test fail verify a file' 'with bad keyring'
260 testfailure --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/joesixpack.pub.
${EXT}" verify "${SIGNATURE}.gpg
" "${SIGNATURE}"
262 msgtest 'Test fail verify a file' 'with non-existing keyring'
263 testfailure --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/does
-not-exist.pub.
${EXT}" verify "${SIGNATURE}.gpg
" "${SIGNATURE}"
264 testfailure test -e "${KEYDIR}/does
-not-exist.pub.
${EXT}"
266 # note: this isn't how apts gpgv method implements keyid for verify
267 msgtest 'Test verify a file' 'with good keyid'
268 testsuccess --nomsg aptkey --quiet --readonly --keyid 'Paranoid' verify "${SIGNATURE}.gpg
" "${SIGNATURE}"
270 msgtest 'Test fail verify a file' 'with bad keyid'
271 testfailure --nomsg aptkey --quiet --readonly --keyid 'Sixpack' verify "${SIGNATURE}.gpg
" "${SIGNATURE}"
273 msgtest 'Test fail verify a file' 'with non-existing keyid'
274 testfailure --nomsg aptkey --quiet --readonly --keyid 'Kalnischkies' verify "${SIGNATURE}.gpg
" "${SIGNATURE}"
276 msgtest 'Test verify fails on' 'bad file'
277 testfailure --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg
" "${SIGNATURE}2"
279 rm -f "${ROOTDIR}/etc
/apt
/apt.conf.d
/00gpgvcmd
"
281 msgtest 'Test verify a file' 'with good keyring'
282 testsuccess --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/testcase
-multikey.pub.
${EXT}" verify "${SIGNATURE}.gpg
" "${SIGNATURE}"
285 cat "${KEYDIR}/joesixpack.pub.gpg
" "${KEYDIR}/marvinparanoid.pub.gpg
" > "${KEYDIR}/double.pub.gpg
"
286 cat "${KEYDIR}/joesixpack.pub.asc
" "${KEYDIR}/marvinparanoid.pub.asc
" > "${KEYDIR}/double.pub.asc
"
287 cat "${KEYDIR}/joesixpack.sec
" "${KEYDIR}/marvinparanoid.sec
" > "${KEYDIR}/double.sec
"
288 cp -a "${KEYDIR}/double.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/double.
${EXT}"
289 cp -a "${KEYDIR}/testcase
-multikey.pub.
${EXT}" "${ROOTDIR}/etc
/apt
/trusted.gpg.d
/multikey.
${EXT}"
290 rm -f "${SIGNATURE}.gpg
"
291 testsuccess aptkey --quiet --keyring "${KEYDIR}/double.pub.gpg
" --secret-keyring "${KEYDIR}/double.sec
" --readonly \
292 adv --batch --yes -u 'Marvin' -u 'Joe' --armor --detach-sign --sign --output "${SIGNATURE}.gpg
" "${SIGNATURE}"
293 testsuccess test -s "${SIGNATURE}.gpg
" -a -s "${SIGNATURE}"
295 for GPGV in '' 'gpgv' 'gpgv1' 'gpgv2'; do
296 echo "APT
::Key
::GPGVCommand
\"$GPGV\";" > "${ROOTDIR}/etc
/apt
/apt.conf.d
/00gpgvcmd
"
297 if [ -n "$GPGV" ] && ! command dpkg -l gnupg1 2>&1 | grep -q '^ii'; then continue; fi
299 msgtest 'Test verify a doublesigned file' 'with all keys'
300 testsuccess --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg
" "${SIGNATURE}"
302 msgtest 'Test verify a doublesigned file' 'with good keyring joe'
303 testmultigpg --keyring "${KEYDIR}/joesixpack.pub.
${EXT}" verify "${SIGNATURE}.gpg
" "${SIGNATURE}"
305 msgtest 'Test verify a doublesigned file' 'with good keyring marvin'
306 testmultigpg --keyring "${KEYDIR}/marvinparanoid.pub.
${EXT}" verify "${SIGNATURE}.gpg
" "${SIGNATURE}"
308 msgtest 'Test fail verify a doublesigned file' 'with bad keyring'
309 testfailure --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/rexexpired.pub.
${EXT}" verify "${SIGNATURE}.gpg
" "${SIGNATURE}"
311 msgtest 'Test fail verify a doublesigned file' 'with non-existing keyring'
312 testfailure --nomsg aptkey --quiet --readonly --keyring "${KEYDIR}/does
-not-exist.pub.
${EXT}" verify "${SIGNATURE}.gpg
" "${SIGNATURE}"
313 testfailure test -e "${KEYDIR}/does
-not-exist.pub.
${EXT}"
315 # note: this isn't how apts gpgv method implements keyid for verify
316 msgtest 'Test verify a doublesigned file' 'with good keyid'
317 testmultigpg --keyid 'Paranoid' verify "${SIGNATURE}.gpg
" "${SIGNATURE}"
319 msgtest 'Test fail verify a doublesigned file' 'with bad keyid'
320 testfailure --nomsg aptkey --quiet --readonly --keyid 'Rex' verify "${SIGNATURE}.gpg
" "${SIGNATURE}"
322 msgtest 'Test fail verify a doublesigned file' 'with non-existing keyid'
323 testfailure --nomsg aptkey --quiet --readonly --keyid 'Kalnischkies' verify "${SIGNATURE}.gpg
" "${SIGNATURE}"
325 msgtest 'Test verify fails on' 'bad doublesigned file'
326 testfailure --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg
" "${SIGNATURE}2"
328 rm -f "${ROOTDIR}/etc
/apt
/apt.conf.d
/00gpgvcmd
"
333 if command dpkg -l gnupg1 2>&1 | grep -q '^ii'; then
334 if [ "$1" = '1' ]; then
340 if [ "$1" = '1' ]; then
346 msgmsg 'Force tests to be run with' "$GPGEXE"
347 echo "APT
::Key
::GPGCommand
\"$GPGEXE\";" > "${ROOTDIR}/etc
/apt
/apt.conf.d
/00gpgcmd
"
348 testsuccess aptkey --readonly adv --version
349 cp "${ROOTDIR}/tmp
/testsuccess.output
" "${TMPWORKINGDIRECTORY}/aptkey.version
"
350 testsuccess grep "^gpg
(GnuPG
) $1\.
" "${TMPWORKINGDIRECTORY}/aptkey.version
"
353 (cd /; find "${TMPWORKINGDIRECTORY}/keys
" -name '*.pub' -type f) | while read trusted; do
354 testsuccess aptkey --keyring "$trusted" adv --armor --export --output "${trusted}.asc
"
355 cp -a "$trusted" "${trusted}.gpg
"
358 # run with default (whatever this is) in current CWD with relative paths
363 # run with … and up the game with a strange CWD & absolute paths
364 ROOTDIR="${TMPWORKINGDIRECTORY}/rootdir
"
365 KEYDIR="${TMPWORKINGDIRECTORY}/keys
"
368 chmod 600 ../inaccessible
369 testfilestats "${TMPWORKINGDIRECTORY}/inaccessible
" '%a' '=' '600'
376 msgmsg 'Tests to be run with' 'asc files'
377 rm -f "${ROOTDIR}/etc
/apt
/apt.conf.d
/00gpgcmd
"