summaryrefslogtreecommitdiffstats
path: root/debian/tests/gpgv-win32
blob: 035c060f01f5b648d0e82bb1b2b96ff856b82302 (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
#!/bin/bash

set -e

export GNUPGHOME=$(mktemp -d)
gpgargs=(--batch --quiet --pinentry-mode=loopback --passphrase '' --with-colons)

# Generate a minimal signing key:
gpg "${gpgargs[@]}" --quick-gen-key 'Test key for gpgv-win32 <test-key@example.com>'

gpg "${gpgargs[@]}" -o "$GNUPGHOME/key.gpg" --export test-key@example.com

# Sign this very script
rm -f "${0}.gpg"
gpg "${gpgargs[@]}" --output "${0}.gpg" --detach-sign "${0}"

# Verify using gpgv
gpgv --quiet --status-fd 3 3> native.status --keyring "$GNUPGHOME/key.gpg" "${0}.gpg" "${0}"

WINE=/usr/lib/wine/wine
export WINESERVER=/usr/lib/wine/wineserver32

# Verify using gpgv.exe (using --status-fd 1 because i don't know how
# to pass a non-standard file descriptor into wine)
"$WINE" /usr/share/win32/gpgv.exe --quiet --status-fd 1 > win32.status --keyring "Z://${GNUPGHOME}/key.gpg" "${0}.gpg" "${0}" 

# convert to unix newlines if necessary:
sed -i 's/\r$//' win32.status

diff -u native.status win32.status

head -v win32.status

rm -rf "$GNUPGHOME"