|
|
60953d7 |
From be8fd5831afa0a04f14cd6206e6576f03ee59558 Mon Sep 17 00:00:00 2001
|
|
|
60953d7 |
From: Amaury Pouly <amaury.pouly@gmail.com>
|
|
|
60953d7 |
Date: Sat, 17 Sep 2016 16:40:46 +0100
|
|
|
60953d7 |
Subject: [PATCH] Fix GPG test
|
|
|
60953d7 |
|
|
|
60953d7 |
At least GnuPG, when run with both --fingerprint and --with-colons will output
|
|
|
60953d7 |
the fingerprint of the public key and the subkey. The command below will thus
|
|
|
60953d7 |
output two fingerprints and the delete command will fail because it cannot
|
|
|
60953d7 |
find the second fingerprint (which is a subkey and not a public key). It seems
|
|
|
60953d7 |
that a safe approach is to consider only the first fingerprint line.
|
|
|
60953d7 |
|
|
|
60953d7 |
Change-Id: I4c6aa79e4473bca146aa087728a5652d91586a81
|
|
|
60953d7 |
---
|
|
|
60953d7 |
tests/Cryptography/keygen.sh | 2 +-
|
|
|
60953d7 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
60953d7 |
|
|
|
60953d7 |
diff --git a/tests/Cryptography/keygen.sh b/tests/Cryptography/keygen.sh
|
|
|
60953d7 |
index c94c0ab..98c69ca 100755
|
|
|
60953d7 |
--- a/tests/Cryptography/keygen.sh
|
|
|
60953d7 |
+++ b/tests/Cryptography/keygen.sh
|
|
|
60953d7 |
@@ -115,7 +115,7 @@ $TAIL" > crypto_test_data.h
|
|
|
60953d7 |
echo -n "key *\nexpire\nseconds=1\nsave\n" | ${GPG} --no-tty --quiet --command-fd 0 --edit-key "expired@test.trojita.flaska.net"
|
|
|
60953d7 |
|
|
|
60953d7 |
# extract fingerprint of key to be deleted
|
|
|
60953d7 |
-FINGERPRINT="$(${GPG} --quiet --no-tty --list-keys --with-colons --fingerprint unknown@test.trojita.flaska.net | grep fpr | cut -d : -f 10)"
|
|
|
60953d7 |
+FINGERPRINT="$(${GPG} --quiet --no-tty --list-keys --with-colons --fingerprint unknown@test.trojita.flaska.net | grep fpr | head -n 1 | cut -d : -f 10)"
|
|
|
60953d7 |
|
|
|
60953d7 |
# delete key
|
|
|
60953d7 |
yes | DISPLAY="" ${GPG} --quiet --batch --no-tty --delete-secret-and-public-key --yes --command-fd 0 --passphrase-fd 0 "${FINGERPRINT}"
|