Skip to contentSkip to conversation

create gpg homedir on the fly and skip RFC1991 tests for gnupg 2.1

PATCH In review Christian Hesse 3 participants 16 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 create gpg homedir on the fly and skip RFC1991 tests for gnupg 2.1

GnuPG 2.1 homedir looks different, so just creat it on the fly by importing needed private and public keys and ownertrust. This solves an issue with gnupg 2.1 running interactive pinentry when old secret key is present.

Additionally GnuPG 2.1 does not longer support RFC1991, so skip these tests.

---
 t/lib-gpg.sh          |  13 ++++++++++---
 t/lib-gpg/ownertrust  |   4 ++++
 t/lib-gpg/random_seed | Bin 600 -> 0 bytes
 t/lib-gpg/trustdb.gpg | Bin 1360 -> 0 bytes
 t/t7004-tag.sh        |  14 +++++++-------
 5 files changed, 21 insertions(+), 10 deletions(-)
 create mode 100644 t/lib-gpg/ownertrust
 delete mode 100644 t/lib-gpg/random_seed
 delete mode 100644 t/lib-gpg/trustdb.gpg
t/lib-gpg.sh +10 -3
index cd2baef..17c45ad 100755
@@ -16,12 +16,19 @@ else
 		# Type DSA and Elgamal, size 2048 bits, no expiration date.
 		# Name and email: C O Mitter <[email protected]>
 		# No password given, to enable non-interactive operation.
-		cp -R "$TEST_DIRECTORY"/lib-gpg ./gpghome
-		chmod 0700 gpghome
-		chmod 0600 gpghome/*
+		mkdir ./gpghome
+		chmod 0700 ./gpghome
 		GNUPGHOME="$(pwd)/gpghome"
 		export GNUPGHOME
+		gpg --homedir "${GNUPGHOME}" --import \
+			"$TEST_DIRECTORY"/lib-gpg/pubring.gpg \
+			"$TEST_DIRECTORY"/lib-gpg/secring.gpg
+		gpg --homedir "${GNUPGHOME}" --import-ownertrust \
+			"$TEST_DIRECTORY"/lib-gpg/ownertrust
 		test_set_prereq GPG
+		if [ -e "${GNUPGHOME}"/pubring.kbx ]; then
+			test_set_prereq GNUPG21
+		fi
 		;;
 	esac
 fi
t/lib-gpg/ownertrust new file +4 -0
new file mode 100644
index 0000000..b3e3c4f
@@ -0,0 +1,4 @@
+# List of assigned trustvalues, created Thu 11 Dec 2014 01:26:28 PM CET
+# (Use "gpg --import-ownertrust" to restore them)
+73D758744BE721698EC54E8713B6F51ECDDE430D:6:
+D4BE22311AD3131E5EDA29A461092E85B7227189:3:
t/lib-gpg/random_seed deleted binary +0 -0
deleted file mode 100644
index 95d249f15fce980f0e8c1a8a18b085b3885708aa..0000000000000000000000000000000000000000
GIT binary patch
t/lib-gpg/trustdb.gpg deleted binary +0 -0
deleted file mode 100644
index 4879ae9a84650a93a4d15bd6560c5d1b89eb4c2f..0000000000000000000000000000000000000000
GIT binary patch
t/t7004-tag.sh +7 -7
index 796e9f7..1c40967 100755
@@ -1081,7 +1081,7 @@ test_expect_success GPG \
 get_tag_header rfc1991-signed-tag $commit commit $time >expect
 echo "RFC1991 signed tag" >>expect
 echo '-----BEGIN PGP MESSAGE-----' >>expect
-test_expect_success GPG \
+test_expect_success GPG,!GNUPG21 \
 	'creating a signed tag with rfc1991' '
 	echo "rfc1991" >gpghome/gpg.conf &&
 	git tag -s -m "RFC1991 signed tag" rfc1991-signed-tag $commit &&
@@ -1095,7 +1095,7 @@ cp "$1" actual
 EOF
 chmod +x fakeeditor
 
-test_expect_success GPG \
+test_expect_success GPG,!GNUPG21 \
 	'reediting a signed tag body omits signature' '
 	echo "rfc1991" >gpghome/gpg.conf &&
 	echo "RFC1991 signed tag" >expect &&
@@ -1103,13 +1103,13 @@ test_expect_success GPG \
 	test_cmp expect actual
 '
 
-test_expect_success GPG \
+test_expect_success GPG,!GNUPG21 \
 	'verifying rfc1991 signature' '
 	echo "rfc1991" >gpghome/gpg.conf &&
 	git tag -v rfc1991-signed-tag
 '
 
-test_expect_success GPG \
+test_expect_success GPG,!GNUPG21 \
 	'list tag with rfc1991 signature' '
 	echo "rfc1991" >gpghome/gpg.conf &&
 	echo "rfc1991-signed-tag RFC1991 signed tag" >expect &&
@@ -1123,12 +1123,12 @@ test_expect_success GPG \
 
 rm -f gpghome/gpg.conf
 
-test_expect_success GPG \
+test_expect_success GPG,!GNUPG21 \
 	'verifying rfc1991 signature without --rfc1991' '
 	git tag -v rfc1991-signed-tag
 '
 
-test_expect_success GPG \
+test_expect_success GPG,!GNUPG21 \
 	'list tag with rfc1991 signature without --rfc1991' '
 	echo "rfc1991-signed-tag RFC1991 signed tag" >expect &&
 	git tag -l -n1 rfc1991-signed-tag >actual &&
@@ -1139,7 +1139,7 @@ test_expect_success GPG \
 	test_cmp expect actual
 '
 
-test_expect_success GPG \
+test_expect_success GPG,!GNUPG21 \
 	'reediting a signed tag body omits signature' '
 	echo "RFC1991 signed tag" >expect &&
 	GIT_EDITOR=./fakeeditor git tag -f -s rfc1991-signed-tag $commit &&
Signature · 1 line
2.2.0
#1 lore raw
Quoted 8 lines · Christian Hesse

GnuPG 2.1 homedir looks different, so just creat it on the fly by importing needed private and public keys and ownertrust. This solves an issue with gnupg 2.1 running interactive pinentry when old secret key is present.

Additionally GnuPG 2.1 does not longer support RFC1991, so skip these tests.
---

Needs a sign-off.

Are older GPG implementations still happy with this new way to initialize their gpghome?

Quoted 9 lines
 t/lib-gpg.sh          |  13 ++++++++++---
 t/lib-gpg/ownertrust  |   4 ++++
 t/lib-gpg/random_seed | Bin 600 -> 0 bytes
 t/lib-gpg/trustdb.gpg | Bin 1360 -> 0 bytes
 t/t7004-tag.sh        |  14 +++++++-------
 5 files changed, 21 insertions(+), 10 deletions(-)
 create mode 100644 t/lib-gpg/ownertrust
 delete mode 100644 t/lib-gpg/random_seed
 delete mode 100644 t/lib-gpg/trustdb.gpg

Do these trust files need to be shipped? In other words, would it be insufficient to just import private-public keyrings? I know we have been shipping trustdb.gpg, and I do not think it is a problem to ship export-ownertrust output, but as long as we are cleaning things up to make us compatible with both older and newer GPG, I thought I'd ask ;-)

Quoted 14 lines
t/lib-gpg.sh +2 -3
index cd2baef..17c45ad 100755
@@ -16,12 +16,19 @@ else
 		# Type DSA and Elgamal, size 2048 bits, no expiration date.
 		# Name and email: C O Mitter <[email protected]>
 		# No password given, to enable non-interactive operation.
-		cp -R "$TEST_DIRECTORY"/lib-gpg ./gpghome
-		chmod 0700 gpghome
-		chmod 0600 gpghome/*
+		mkdir ./gpghome
+		chmod 0700 ./gpghome
 		GNUPGHOME="$(pwd)/gpghome"

t/lib-gpg.sh else · line 31

Quoted 10 lines
t/lib-gpg.sh +8 -0
 		export GNUPGHOME
+		gpg --homedir "${GNUPGHOME}" --import \
+			"$TEST_DIRECTORY"/lib-gpg/pubring.gpg \
+			"$TEST_DIRECTORY"/lib-gpg/secring.gpg
+		gpg --homedir "${GNUPGHOME}" --import-ownertrust \
+			"$TEST_DIRECTORY"/lib-gpg/ownertrust
 		test_set_prereq GPG
+		if [ -e "${GNUPGHOME}"/pubring.kbx ]; then
+			test_set_prereq GNUPG21
+		fi

Instead of !GNUPG21 prerequisite, how about using a RFC1991 prerequisite, which is satisfied by older GPG but not by the ones that lack support? That is,

	...
        test_set_prereq GPG
	if ! test "${GNUPGHOME}"/pubring.kbx
        then
		test_set_prereq GPG_RFC1991
	fi

or something. That way, we do not have to be in a funny situation where we say a version of GPG satisfies GNUPG21 prereq but it in fact is GPG version 4.3 in the future.

Thanks.

#2 lore raw

Junio C Hamano <[email protected]> on Thu, 2014/12/11 14:41:

Quoted 7 lines
Quoted 5 lines · Christian Hesse

GnuPG 2.1 homedir looks different, so just creat it on the fly by importing needed private and public keys and ownertrust. This solves an issue with gnupg 2.1 running interactive pinentry when old secret key is present.

Quoted 5 lines
Quoted 3 lines

Additionally GnuPG 2.1 does not longer support RFC1991, so skip these tests.
---

Needs a sign-off.

Damn... But yes, you are right. ;)

Quoted 2 lines

Are older GPG implementations still happy with this new way to initialize their gpghome?

Yes, tested with gnupg 1.4.10 from Debian squeeze (6.x). Everybody is welcome to test on her/his distribution, though. ;)

Quoted 10 lines
Quoted 9 lines
 t/lib-gpg.sh          |  13 ++++++++++---
 t/lib-gpg/ownertrust  |   4 ++++
 t/lib-gpg/random_seed | Bin 600 -> 0 bytes
 t/lib-gpg/trustdb.gpg | Bin 1360 -> 0 bytes
 t/t7004-tag.sh        |  14 +++++++-------
 5 files changed, 21 insertions(+), 10 deletions(-)
 create mode 100644 t/lib-gpg/ownertrust
 delete mode 100644 t/lib-gpg/random_seed
 delete mode 100644 t/lib-gpg/trustdb.gpg
Quoted 6 lines

Do these trust files need to be shipped? In other words, would it be insufficient to just import private-public keyrings? I know we have been shipping trustdb.gpg, and I do not think it is a problem to ship export-ownertrust output, but as long as we are cleaning things up to make us compatible with both older and newer GPG, I thought I'd ask ;-)

Yes, we need this.
Some tests check for the trust level, e.g t7510-signed-commit.sh being one of these.

Quoted 36 lines
Quoted 14 lines
t/lib-gpg.sh +0 -0
index cd2baef..17c45ad 100755
@@ -16,12 +16,19 @@ else
 		# Type DSA and Elgamal, size 2048 bits, no expiration

date. # Name and email: C O Mitter <[email protected]>

t/lib-gpg.sh +2 -3
 		# No password given, to enable non-interactive operation.
-		cp -R "$TEST_DIRECTORY"/lib-gpg ./gpghome
-		chmod 0700 gpghome
-		chmod 0600 gpghome/*
+		mkdir ./gpghome
+		chmod 0700 ./gpghome
 		GNUPGHOME="$(pwd)/gpghome"

t/lib-gpg.sh else · line 31

Quoted 10 lines
t/lib-gpg.sh +8 -0
 		export GNUPGHOME
+		gpg --homedir "${GNUPGHOME}" --import \
+			"$TEST_DIRECTORY"/lib-gpg/pubring.gpg \
+			"$TEST_DIRECTORY"/lib-gpg/secring.gpg
+		gpg --homedir "${GNUPGHOME}" --import-ownertrust \
+			"$TEST_DIRECTORY"/lib-gpg/ownertrust
 		test_set_prereq GPG
+		if [ -e "${GNUPGHOME}"/pubring.kbx ]; then
+			test_set_prereq GNUPG21
+		fi

Instead of !GNUPG21 prerequisite, how about using a RFC1991 prerequisite, which is satisfied by older GPG but not by the ones that lack support? That is,

	...
        test_set_prereq GPG
	if ! test "${GNUPGHOME}"/pubring.kbx
        then
		test_set_prereq GPG_RFC1991
	fi
Quoted 3 lines

or something. That way, we do not have to be in a funny situation where we say a version of GPG satisfies GNUPG21 prereq but it in fact is GPG version 4.3 in the future.

Makes sense.
In addition I do check if gpg does work if --rfc1991 is given, no more checking for keyring file.

I will reply with a new series of patches.

Signature · 2 lines
Best regards,
Chris
#3 lore raw

PATCH 1/3 create gpg homedir on the fly

GnuPG 2.1 homedir looks different, so just creat it on the fly by importing needed private and public keys and ownertrust. This solves an issue with gnupg 2.1 running interactive pinentry when old secret key is present.

---
 t/lib-gpg.sh          |  10 +++++++---
 t/lib-gpg/ownertrust  |   4 ++++
 t/lib-gpg/random_seed | Bin 600 -> 0 bytes
 t/lib-gpg/trustdb.gpg | Bin 1360 -> 0 bytes
 4 files changed, 11 insertions(+), 3 deletions(-)
 create mode 100644 t/lib-gpg/ownertrust
 delete mode 100644 t/lib-gpg/random_seed
 delete mode 100644 t/lib-gpg/trustdb.gpg
t/lib-gpg.sh +7 -3
index cd2baef..4e57942 100755
@@ -16,11 +16,15 @@ else
 		# Type DSA and Elgamal, size 2048 bits, no expiration date.
 		# Name and email: C O Mitter <[email protected]>
 		# No password given, to enable non-interactive operation.
-		cp -R "$TEST_DIRECTORY"/lib-gpg ./gpghome
-		chmod 0700 gpghome
-		chmod 0600 gpghome/*
+		mkdir ./gpghome
+		chmod 0700 ./gpghome
 		GNUPGHOME="$(pwd)/gpghome"
 		export GNUPGHOME
+		gpg --homedir "${GNUPGHOME}" --import \
+			"$TEST_DIRECTORY"/lib-gpg/pubring.gpg \
+			"$TEST_DIRECTORY"/lib-gpg/secring.gpg
+		gpg --homedir "${GNUPGHOME}" --import-ownertrust \
+			"$TEST_DIRECTORY"/lib-gpg/ownertrust
 		test_set_prereq GPG
 		;;
 	esac
t/lib-gpg/ownertrust new file +4 -0
new file mode 100644
index 0000000..b3e3c4f
@@ -0,0 +1,4 @@
+# List of assigned trustvalues, created Thu 11 Dec 2014 01:26:28 PM CET
+# (Use "gpg --import-ownertrust" to restore them)
+73D758744BE721698EC54E8713B6F51ECDDE430D:6:
+D4BE22311AD3131E5EDA29A461092E85B7227189:3:
t/lib-gpg/random_seed deleted binary +0 -0
deleted file mode 100644
index 95d249f15fce980f0e8c1a8a18b085b3885708aa..0000000000000000000000000000000000000000
GIT binary patch
t/lib-gpg/trustdb.gpg deleted binary +0 -0
deleted file mode 100644
index 4879ae9a84650a93a4d15bd6560c5d1b89eb4c2f..0000000000000000000000000000000000000000
GIT binary patch
Signature · 1 line
2.2.0
#4 lore raw

PATCH 2/3 skip RFC1991 tests for gnupg 2.1

GnuPG >= 2.1.0 does not longer support RFC1991, so skip these tests.

---
 t/lib-gpg.sh   |  3 +++
 t/t7004-tag.sh | 14 +++++++-------
 2 files changed, 10 insertions(+), 7 deletions(-)
t/lib-gpg.sh +3 -0
index 4e57942..b0138ad 100755
@@ -26,6 +26,9 @@ else
 		gpg --homedir "${GNUPGHOME}" --import-ownertrust \
 			"$TEST_DIRECTORY"/lib-gpg/ownertrust
 		test_set_prereq GPG
+		if echo | gpg --homedir "${GNUPGHOME}" -b --rfc1991 >/dev/null 2>/dev/null; then
+			test_set_prereq RFC1991
+		fi
 		;;
 	esac
 fi
t/t7004-tag.sh +7 -7
index 796e9f7..35c805a 100755
@@ -1081,7 +1081,7 @@ test_expect_success GPG \
 get_tag_header rfc1991-signed-tag $commit commit $time >expect
 echo "RFC1991 signed tag" >>expect
 echo '-----BEGIN PGP MESSAGE-----' >>expect
-test_expect_success GPG \
+test_expect_success GPG,RFC1991 \
 	'creating a signed tag with rfc1991' '
 	echo "rfc1991" >gpghome/gpg.conf &&
 	git tag -s -m "RFC1991 signed tag" rfc1991-signed-tag $commit &&
@@ -1095,7 +1095,7 @@ cp "$1" actual
 EOF
 chmod +x fakeeditor
 
-test_expect_success GPG \
+test_expect_success GPG,RFC1991 \
 	'reediting a signed tag body omits signature' '
 	echo "rfc1991" >gpghome/gpg.conf &&
 	echo "RFC1991 signed tag" >expect &&
@@ -1103,13 +1103,13 @@ test_expect_success GPG \
 	test_cmp expect actual
 '
 
-test_expect_success GPG \
+test_expect_success GPG,RFC1991 \
 	'verifying rfc1991 signature' '
 	echo "rfc1991" >gpghome/gpg.conf &&
 	git tag -v rfc1991-signed-tag
 '
 
-test_expect_success GPG \
+test_expect_success GPG,RFC1991 \
 	'list tag with rfc1991 signature' '
 	echo "rfc1991" >gpghome/gpg.conf &&
 	echo "rfc1991-signed-tag RFC1991 signed tag" >expect &&
@@ -1123,12 +1123,12 @@ test_expect_success GPG \
 
 rm -f gpghome/gpg.conf
 
-test_expect_success GPG \
+test_expect_success GPG,RFC1991 \
 	'verifying rfc1991 signature without --rfc1991' '
 	git tag -v rfc1991-signed-tag
 '
 
-test_expect_success GPG \
+test_expect_success GPG,RFC1991 \
 	'list tag with rfc1991 signature without --rfc1991' '
 	echo "rfc1991-signed-tag RFC1991 signed tag" >expect &&
 	git tag -l -n1 rfc1991-signed-tag >actual &&
@@ -1139,7 +1139,7 @@ test_expect_success GPG \
 	test_cmp expect actual
 '
 
-test_expect_success GPG \
+test_expect_success GPG,RFC1991 \
 	'reediting a signed tag body omits signature' '
 	echo "RFC1991 signed tag" >expect &&
 	GIT_EDITOR=./fakeeditor git tag -f -s rfc1991-signed-tag $commit &&
Signature · 1 line
2.2.0
#5 lore raw

PATCH 3/3 replace binary keyrings with armored keys

In reply to Christian Hesse
---
 t/lib-gpg.sh          |   3 +-
 t/lib-gpg/keyring.gpg |  88 ++++++++++++++++++++++++++++++++++++++++++++++++++
 t/lib-gpg/pubring.gpg | Bin 2359 -> 0 bytes
 t/lib-gpg/secring.gpg | Bin 3734 -> 0 bytes
 4 files changed, 89 insertions(+), 2 deletions(-)
 create mode 100644 t/lib-gpg/keyring.gpg
 delete mode 100644 t/lib-gpg/pubring.gpg
 delete mode 100644 t/lib-gpg/secring.gpg
t/lib-gpg.sh +1 -2
index b0138ad..03c2dd3 100755
@@ -21,8 +21,7 @@ else
 		GNUPGHOME="$(pwd)/gpghome"
 		export GNUPGHOME
 		gpg --homedir "${GNUPGHOME}" --import \
-			"$TEST_DIRECTORY"/lib-gpg/pubring.gpg \
-			"$TEST_DIRECTORY"/lib-gpg/secring.gpg
+			"$TEST_DIRECTORY"/lib-gpg/keyring.gpg
 		gpg --homedir "${GNUPGHOME}" --import-ownertrust \
 			"$TEST_DIRECTORY"/lib-gpg/ownertrust
 		test_set_prereq GPG
t/lib-gpg/keyring.gpg new file +88 -0

88 lines not on this page · raw message

t/lib-gpg/pubring.gpg deleted binary +0 -0
deleted file mode 100644
index 1a3c2d487c2fda9169751a3068fa51e853a1e519..0000000000000000000000000000000000000000
GIT binary patch
t/lib-gpg/secring.gpg deleted binary +0 -0
deleted file mode 100644
index 82dca8f80bf170fde5705862c3eeb9d994725042..0000000000000000000000000000000000000000
GIT binary patch
Signature · 1 line
2.2.0
#6 lore raw

Re: [PATCH 3/3] replace binary keyrings with armored keys

Quoted 2 lines · Christian Hesse

---

Could you explain why it is a good idea to do this to the future readers of "git log" who encounter this change?

Note that I do not have a particular objection to this change. If the original were using a single file as an import source and that happened to be ascii-armored, I wouldn't have suggested a patch that is a reverse of this patch to split it into two binary keyrings.

It's just that I do not want to see "replace X with Y" without any mention of "because Y is better than X in such and such way", especially when X and Y would equally work well. The reason does not have to be particularly strong, and something like "a single unreadable ASCII-armored blob is sufficient for the purpose of our test set-up, instead of two unreadable binary blobs" is sufficient.

And there is more reason than that, then we would definitely want to know about it (e.g. there is a plan in the future to drop importing binary on the GPG side; importing pubring and then secring may not work and the order may have to be swapped, or any random reason that makes "X and Y would equally work well" untrue).

Thanks.

Quoted 252 lines
 t/lib-gpg.sh          |   3 +-
 t/lib-gpg/keyring.gpg |  88 ++++++++++++++++++++++++++++++++++++++++++++++++++
 t/lib-gpg/pubring.gpg | Bin 2359 -> 0 bytes
 t/lib-gpg/secring.gpg | Bin 3734 -> 0 bytes
 4 files changed, 89 insertions(+), 2 deletions(-)
 create mode 100644 t/lib-gpg/keyring.gpg
 delete mode 100644 t/lib-gpg/pubring.gpg
 delete mode 100644 t/lib-gpg/secring.gpg
t/lib-gpg.sh +1 -2
index b0138ad..03c2dd3 100755
@@ -21,8 +21,7 @@ else
 		GNUPGHOME="$(pwd)/gpghome"
 		export GNUPGHOME
 		gpg --homedir "${GNUPGHOME}" --import \
-			"$TEST_DIRECTORY"/lib-gpg/pubring.gpg \
-			"$TEST_DIRECTORY"/lib-gpg/secring.gpg
+			"$TEST_DIRECTORY"/lib-gpg/keyring.gpg
 		gpg --homedir "${GNUPGHOME}" --import-ownertrust \
 			"$TEST_DIRECTORY"/lib-gpg/ownertrust
 		test_set_prereq GPG
t/lib-gpg/keyring.gpg new file +88 -0
new file mode 100644
index 0000000..fb1f048
@@ -0,0 +1,88 @@
+-----BEGIN PGP PRIVATE KEY BLOCK-----
+Version: GnuPG v1
+
+lQG7BEZnyykRBACzCPjIpTYNL7Y2tQqlEGTTDlvZcWNLjF5f7ZzuyOqNOidLUgFD
+36qch1LZLSZkShdR3Gae+bsolyjxrlFuFP0eXRPMtqK20aLw7WZvPFpEV1ThMne+
+PRJjYrvghWw3L0VVIAIZ8GXwrVBuU99uEjHEI0ojYloOvFc2jVPgSaoBvwCg48Tj
+fol2foSoJa7XUu9yAL8szg8D/RUsTzNF+I9hSRHl7MYKFMYoKEY9BDgrgAujp7YY
+8qdGsiUb0Ggyzp2kRjZFt4lpcvKhGfHn5GEjmtk+fRbD5qPfMqKFW+T0NPfYlYmL
+JJ4fs4qZ8Lx7x6iG6X51u+YNwsQuIGjMCC3CeNi3F7or651kkNYASbaQ1NROkCIN
+NudyA/0aasvoZUoNJAc2cP5Ifs6WhXMWLfMR2p2XbfKwKNYneec60usnSComcKqh
+sJVk0Gytvr3FOYVhRkXnKAbx+0W2urFP8OFVBTEKO6Ts2VygWGgneQYoHnqzwlUE
+yjOjlr+lyf7u2s/KAxpKA6jnttEdRZAmzWkhuox1wwAUkr27/QAAn3TEzKR1pxxR
++R3dHuFpnnfatMIDC5O0IkMgTyBNaXR0ZXIgPGNvbW1pdHRlckBleGFtcGxlLmNv
+bT6IXgQTEQIAHgUCRmfLKQIbAwYLCQ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1XW0CNDAeuWKh90ERjyl4Cg7PnWS
+Z9Ei+zj6JD5Pcdi3BJhQo9WOLOVEJ0NHmewTYqk9QVXH/0v1Hdl4LMJtgcbdbDWk
+4UTkXbg9pn3umCgkNJ3Vs8fWnIWO9Izdr2/wrFY2JvUT7Yvl+wsNIWatvOEzGy7n
+BOW78WUxzhu0YJTLKy+iKCjg5HS5dx6OC+e4aEEgfhNPCMkbvDsJjtQ=
+=hieJ
+-----END PGP PRIVATE KEY BLOCK-----
t/lib-gpg/pubring.gpg deleted binary +0 -0
deleted file mode 100644
index 1a3c2d487c2fda9169751a3068fa51e853a1e519..0000000000000000000000000000000000000000
GIT binary patch
t/lib-gpg/secring.gpg deleted binary +0 -0
deleted file mode 100644
index 82dca8f80bf170fde5705862c3eeb9d994725042..0000000000000000000000000000000000000000
GIT binary patch
#7 lore raw

PATCH 3/3 replace binary keyrings with armored keys

Importing PGP key public and security ring works, but this is supposed for runtime. As name suggests we prefer exported format for import.

The extra benefit is that we do not have all secret keys in one binary blob and all public keys in another. Instead public and secret keys for one key pair are bundled.

By using armored format (which is plain ASCII) we can just concatenate the key pairs in one file. (First block is 0xCDDE430D, second block is 0xB7227189.) The individual key pairs can be added and/or removed with simple text editor. Last but not least git and patch can handle this a lot better.

---
 t/lib-gpg.sh          |   3 +-
 t/lib-gpg/keyring.gpg |  88 ++++++++++++++++++++++++++++++++++++++++++++++++++
 t/lib-gpg/pubring.gpg | Bin 2359 -> 0 bytes
 t/lib-gpg/secring.gpg | Bin 3734 -> 0 bytes
 4 files changed, 89 insertions(+), 2 deletions(-)
 create mode 100644 t/lib-gpg/keyring.gpg
 delete mode 100644 t/lib-gpg/pubring.gpg
 delete mode 100644 t/lib-gpg/secring.gpg
t/lib-gpg.sh +1 -2
index b0138ad..03c2dd3 100755
@@ -21,8 +21,7 @@ else
                GNUPGHOME="$(pwd)/gpghome"
                export GNUPGHOME
                gpg --homedir "${GNUPGHOME}" --import \
-                       "$TEST_DIRECTORY"/lib-gpg/pubring.gpg \
-                       "$TEST_DIRECTORY"/lib-gpg/secring.gpg
+                       "$TEST_DIRECTORY"/lib-gpg/keyring.gpg
                gpg --homedir "${GNUPGHOME}" --import-ownertrust \
                        "$TEST_DIRECTORY"/lib-gpg/ownertrust
                test_set_prereq GPG
t/lib-gpg/keyring.gpg new file +88 -0

88 lines not on this page · raw message

t/lib-gpg/pubring.gpg deleted binary +0 -0
deleted file mode 100644
index 1a3c2d487c2fda9169751a3068fa51e853a1e519..0000000000000000000000000000000000000000
GIT binary patch
t/lib-gpg/secring.gpg deleted binary +0 -0
deleted file mode 100644
index 82dca8f80bf170fde5705862c3eeb9d994725042..0000000000000000000000000000000000000000
GIT binary patch
Signature · 1 line
2.2.0
#8 lore raw

Re: [PATCH 3/3] replace binary keyrings with armored keys

Quoted 7 lines · Christian Hesse

Importing PGP key public and security ring works, but this is supposed for runtime. As name suggests we prefer exported format for import.

The extra benefit is that we do not have all secret keys in one binary blob and all public keys in another. Instead public and secret keys for one key pair are bundled.

Quoted 5 lines

By using armored format (which is plain ASCII) we can just concatenate the key pairs in one file. (First block is 0xCDDE430D, second block is 0xB7227189.) The individual key pairs can be added and/or removed with simple text editor. Last but not least git and patch can handle this a lot better.

Actually we can handle binary patch just fine ;-)

Will replace what I queued earlier with this one. Thanks.

Quoted 255 lines
---
 t/lib-gpg.sh          |   3 +-
 t/lib-gpg/keyring.gpg |  88 ++++++++++++++++++++++++++++++++++++++++++++++++++
 t/lib-gpg/pubring.gpg | Bin 2359 -> 0 bytes
 t/lib-gpg/secring.gpg | Bin 3734 -> 0 bytes
 4 files changed, 89 insertions(+), 2 deletions(-)
 create mode 100644 t/lib-gpg/keyring.gpg
 delete mode 100644 t/lib-gpg/pubring.gpg
 delete mode 100644 t/lib-gpg/secring.gpg
t/lib-gpg.sh +1 -2
index b0138ad..03c2dd3 100755
@@ -21,8 +21,7 @@ else
                GNUPGHOME="$(pwd)/gpghome"
                export GNUPGHOME
                gpg --homedir "${GNUPGHOME}" --import \
-                       "$TEST_DIRECTORY"/lib-gpg/pubring.gpg \
-                       "$TEST_DIRECTORY"/lib-gpg/secring.gpg
+                       "$TEST_DIRECTORY"/lib-gpg/keyring.gpg
                gpg --homedir "${GNUPGHOME}" --import-ownertrust \
                        "$TEST_DIRECTORY"/lib-gpg/ownertrust
                test_set_prereq GPG
t/lib-gpg/keyring.gpg new file +88 -0
new file mode 100644
index 0000000..fb1f048
@@ -0,0 +1,88 @@
+-----BEGIN PGP PRIVATE KEY BLOCK-----
+Version: GnuPG v1
+
+lQG7BEZnyykRBACzCPjIpTYNL7Y2tQqlEGTTDlvZcWNLjF5f7ZzuyOqNOidLUgFD
+36qch1LZLSZkShdR3Gae+bsolyjxrlFuFP0eXRPMtqK20aLw7WZvPFpEV1ThMne+
+PRJjYrvghWw3L0VVIAIZ8GXwrVBuU99uEjHEI0ojYloOvFc2jVPgSaoBvwCg48Tj
+fol2foSoJa7XUu9yAL8szg8D/RUsTzNF+I9hSRHl7MYKFMYoKEY9BDgrgAujp7YY
+8qdGsiUb0Ggyzp2kRjZFt4lpcvKhGfHn5GEjmtk+fRbD5qPfMqKFW+T0NPfYlYmL
+JJ4fs4qZ8Lx7x6iG6X51u+YNwsQuIGjMCC3CeNi3F7or651kkNYASbaQ1NROkCIN
+NudyA/0aasvoZUoNJAc2cP5Ifs6WhXMWLfMR2p2XbfKwKNYneec60usnSComcKqh
+sJVk0Gytvr3FOYVhRkXnKAbx+0W2urFP8OFVBTEKO6Ts2VygWGgneQYoHnqzwlUE
+yjOjlr+lyf7u2s/KAxpKA6jnttEdRZAmzWkhuox1wwAUkr27/QAAn3TEzKR1pxxR
++R3dHuFpnnfatMIDC5O0IkMgTyBNaXR0ZXIgPGNvbW1pdHRlckBleGFtcGxlLmNv
+bT6IXgQTEQIAHgUCRmfLKQIbAwYLCQgHAwIDFQIDAxYCAQIeAQIXgAAKCRATtvUe
+zd5DDXQdAKC92f+wOrTkbmPEf+u+qA/Gv6BxQwCfQ128JXCi3MpMB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MJtgcbdbDWk
+4UTkXbg9pn3umCgkNJ3Vs8fWnIWO9Izdr2/wrFY2JvUT7Yvl+wsNIWatvOEzGy7n
+BOW78WUxzhu0YJTLKy+iKCjg5HS5dx6OC+e4aEEgfhNPCMkbvDsJjtQ=
+=hieJ
+-----END PGP PRIVATE KEY BLOCK-----
t/lib-gpg/pubring.gpg deleted binary +0 -0
deleted file mode 100644
index 1a3c2d487c2fda9169751a3068fa51e853a1e519..0000000000000000000000000000000000000000
GIT binary patch
t/lib-gpg/secring.gpg deleted binary +0 -0
deleted file mode 100644
index 82dca8f80bf170fde5705862c3eeb9d994725042..0000000000000000000000000000000000000000
GIT binary patch
#9 lore raw

Re: [PATCH 3/3] replace binary keyrings with armored keys

Junio C Hamano <[email protected]> on Fri, 2014/12/12 13:50:

Quoted 5 lines
Quoted 2 lines · Christian Hesse

Last but not least git and patch can handle this a lot better.

Actually we can handle binary patch just fine ;-)

Ah, that was kind of misleading. :-p
Generating a patch with git including binary data and trying to apply with patch results in something like "git binary diffs are not supported".

Anyway... Thanks for applying!

Signature · 2 lines
Best regards,
Chris
#10 lore raw

Re: [PATCH 1/3] create gpg homedir on the fly

In reply to Christian Hesse
Quoted 1 line · Christian Hesse

GnuPG 2.1 homedir looks different, so just creat it on the fly by

s/creat/create/

Quoted 5 lines

importing needed private and public keys and ownertrust. This solves an issue with gnupg 2.1 running interactive pinentry when old secret key is present.

#11 lore raw

PATCH 1/3 create gpg homedir on the fly

GnuPG 2.1 homedir looks different, so just create it on the fly by importing needed private and public keys and ownertrust. This solves an issue with gnupg 2.1 running interactive pinentry when old secret key is present.

---
 t/lib-gpg.sh          |  10 +++++++---
 t/lib-gpg/ownertrust  |   4 ++++
 t/lib-gpg/random_seed | Bin 600 -> 0 bytes
 t/lib-gpg/trustdb.gpg | Bin 1360 -> 0 bytes
 4 files changed, 11 insertions(+), 3 deletions(-)
 create mode 100644 t/lib-gpg/ownertrust
 delete mode 100644 t/lib-gpg/random_seed
 delete mode 100644 t/lib-gpg/trustdb.gpg
t/lib-gpg.sh +7 -3
index cd2baef..4e57942 100755
@@ -16,11 +16,15 @@ else
 		# Type DSA and Elgamal, size 2048 bits, no expiration date.
 		# Name and email: C O Mitter <[email protected]>
 		# No password given, to enable non-interactive operation.
-		cp -R "$TEST_DIRECTORY"/lib-gpg ./gpghome
-		chmod 0700 gpghome
-		chmod 0600 gpghome/*
+		mkdir ./gpghome
+		chmod 0700 ./gpghome
 		GNUPGHOME="$(pwd)/gpghome"
 		export GNUPGHOME
+		gpg --homedir "${GNUPGHOME}" --import \
+			"$TEST_DIRECTORY"/lib-gpg/pubring.gpg \
+			"$TEST_DIRECTORY"/lib-gpg/secring.gpg
+		gpg --homedir "${GNUPGHOME}" --import-ownertrust \
+			"$TEST_DIRECTORY"/lib-gpg/ownertrust
 		test_set_prereq GPG
 		;;
 	esac
t/lib-gpg/ownertrust new file +4 -0
new file mode 100644
index 0000000..b3e3c4f
@@ -0,0 +1,4 @@
+# List of assigned trustvalues, created Thu 11 Dec 2014 01:26:28 PM CET
+# (Use "gpg --import-ownertrust" to restore them)
+73D758744BE721698EC54E8713B6F51ECDDE430D:6:
+D4BE22311AD3131E5EDA29A461092E85B7227189:3:
t/lib-gpg/random_seed deleted binary +0 -0
deleted file mode 100644
index 95d249f15fce980f0e8c1a8a18b085b3885708aa..0000000000000000000000000000000000000000
GIT binary patch
t/lib-gpg/trustdb.gpg deleted binary +0 -0
deleted file mode 100644
index 4879ae9a84650a93a4d15bd6560c5d1b89eb4c2f..0000000000000000000000000000000000000000
GIT binary patch
Signature · 1 line
2.2.0
#12 lore raw

Re: [PATCH 1/3] create gpg homedir on the fly

In reply to Christian Hesse
Quoted 7 lines · Christian Hesse

GnuPG 2.1 homedir looks different, so just creat it on the fly by importing needed private and public keys and ownertrust. This solves an issue with gnupg 2.1 running interactive pinentry when old secret key is present.

---

Thanks; will queue with s/just creat/&e/;

Quoted 75 lines
 t/lib-gpg.sh          |  10 +++++++---
 t/lib-gpg/ownertrust  |   4 ++++
 t/lib-gpg/random_seed | Bin 600 -> 0 bytes
 t/lib-gpg/trustdb.gpg | Bin 1360 -> 0 bytes
 4 files changed, 11 insertions(+), 3 deletions(-)
 create mode 100644 t/lib-gpg/ownertrust
 delete mode 100644 t/lib-gpg/random_seed
 delete mode 100644 t/lib-gpg/trustdb.gpg
t/lib-gpg.sh +7 -3
index cd2baef..4e57942 100755
@@ -16,11 +16,15 @@ else
 		# Type DSA and Elgamal, size 2048 bits, no expiration date.
 		# Name and email: C O Mitter <[email protected]>
 		# No password given, to enable non-interactive operation.
-		cp -R "$TEST_DIRECTORY"/lib-gpg ./gpghome
-		chmod 0700 gpghome
-		chmod 0600 gpghome/*
+		mkdir ./gpghome
+		chmod 0700 ./gpghome
 		GNUPGHOME="$(pwd)/gpghome"
 		export GNUPGHOME
+		gpg --homedir "${GNUPGHOME}" --import \
+			"$TEST_DIRECTORY"/lib-gpg/pubring.gpg \
+			"$TEST_DIRECTORY"/lib-gpg/secring.gpg
+		gpg --homedir "${GNUPGHOME}" --import-ownertrust \
+			"$TEST_DIRECTORY"/lib-gpg/ownertrust
 		test_set_prereq GPG
 		;;
 	esac
t/lib-gpg/ownertrust new file +4 -0
new file mode 100644
index 0000000..b3e3c4f
@@ -0,0 +1,4 @@
+# List of assigned trustvalues, created Thu 11 Dec 2014 01:26:28 PM CET
+# (Use "gpg --import-ownertrust" to restore them)
+73D758744BE721698EC54E8713B6F51ECDDE430D:6:
+D4BE22311AD3131E5EDA29A461092E85B7227189:3:
t/lib-gpg/random_seed deleted binary +0 -0
deleted file mode 100644
index 95d249f15fce980f0e8c1a8a18b085b3885708aa..0000000000000000000000000000000000000000
GIT binary patch
t/lib-gpg/trustdb.gpg deleted binary +0 -0
deleted file mode 100644
index 4879ae9a84650a93a4d15bd6560c5d1b89eb4c2f..0000000000000000000000000000000000000000
GIT binary patch
#13 lore raw

Re: [PATCH 1/3] create gpg homedir on the fly

In reply to Christian Hesse

After queuing these three, I _think_ it is better to have something like this patch on top, as it is distracting to let the GPG message while setting up the test gpghome leak into the test output, especially without running these tests with "-v" option.

The splitting of RFC1991 prerequiste part is about future-proofing. When we want to define other kinds of specific prerequisites in the future, I'd prefer to see it done separately from the basic set-up code.

Thanks.

 t/lib-gpg.sh | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
t/lib-gpg.sh +14 -12
index b611b78..33de402 100755
@@ -16,23 +16,25 @@ else
 		# Type DSA and Elgamal, size 2048 bits, no expiration date.
 		# Name and email: C O Mitter <[email protected]>
 		# No password given, to enable non-interactive operation.
-		mkdir ./gpghome
-		chmod 0700 ./gpghome
-		GNUPGHOME="$(pwd)/gpghome"
-		export GNUPGHOME
-		gpg --homedir "${GNUPGHOME}" --import \
-			"$TEST_DIRECTORY"/lib-gpg/keyring.gpg
-		gpg --homedir "${GNUPGHOME}" --import-ownertrust \
-			"$TEST_DIRECTORY"/lib-gpg/ownertrust
+		mkdir ./gpghome &&
+		chmod 0700 ./gpghome &&
+		GNUPGHOME="$(pwd)/gpghome" &&
+		export GNUPGHOME &&
+		gpg --homedir "${GNUPGHOME}" 2>/dev/null --import \
+			"$TEST_DIRECTORY"/lib-gpg/keyring.gpg &&
+		gpg --homedir "${GNUPGHOME}" 2>/dev/null --import-ownertrust \
+			"$TEST_DIRECTORY"/lib-gpg/ownertrust &&
 		test_set_prereq GPG
-		if echo | gpg --homedir "${GNUPGHOME}" -b --rfc1991 >/dev/null 2>&1
-		then
-			test_set_prereq RFC1991
-		fi
 		;;
 	esac
 fi
 
+if test_have_prereq GPG &&
+    echo | gpg --homedir "${GNUPGHOME}" -b --rfc1991 >/dev/null 2>&1
+then
+	test_set_prereq RFC1991
+fi
+
 sanitize_pgp() {
 	perl -ne '
 		/^-----END PGP/ and $in_pgp = 0;
#14 lore raw

Re: [PATCH 1/3] create gpg homedir on the fly

In reply to Christian Hesse

After queuing these three, I _think_ it is better to have something like this patch on top, as it is distracting to let the GPG message while setting up the test gpghome leak into the test output, especially without running these tests with "-v" option.

The splitting of RFC1991 prerequiste part is about future-proofing. When we want to define other kinds of specific prerequisites in the future, I'd prefer to see it done separately from the basic set-up code.

 t/lib-gpg.sh | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
t/lib-gpg.sh +14 -12
index b611b78..33de402 100755
@@ -16,23 +16,25 @@ else
 		# Type DSA and Elgamal, size 2048 bits, no expiration date.
 		# Name and email: C O Mitter <[email protected]>
 		# No password given, to enable non-interactive operation.
-		mkdir ./gpghome
-		chmod 0700 ./gpghome
-		GNUPGHOME="$(pwd)/gpghome"
-		export GNUPGHOME
-		gpg --homedir "${GNUPGHOME}" --import \
-			"$TEST_DIRECTORY"/lib-gpg/keyring.gpg
-		gpg --homedir "${GNUPGHOME}" --import-ownertrust \
-			"$TEST_DIRECTORY"/lib-gpg/ownertrust
+		mkdir ./gpghome &&
+		chmod 0700 ./gpghome &&
+		GNUPGHOME="$(pwd)/gpghome" &&
+		export GNUPGHOME &&
+		gpg --homedir "${GNUPGHOME}" 2>/dev/null --import \
+			"$TEST_DIRECTORY"/lib-gpg/keyring.gpg &&
+		gpg --homedir "${GNUPGHOME}" 2>/dev/null --import-ownertrust \
+			"$TEST_DIRECTORY"/lib-gpg/ownertrust &&
 		test_set_prereq GPG
-		if echo | gpg --homedir "${GNUPGHOME}" -b --rfc1991 >/dev/null 2>&1
-		then
-			test_set_prereq RFC1991
-		fi
 		;;
 	esac
 fi
 
+if test_have_prereq GPG &&
+    echo | gpg --homedir "${GNUPGHOME}" -b --rfc1991 >/dev/null 2>&1
+then
+	test_set_prereq RFC1991
+fi
+
 sanitize_pgp() {
 	perl -ne '
 		/^-----END PGP/ and $in_pgp = 0;
#15 lore raw

Re: [PATCH 1/3] create gpg homedir on the fly

Junio C Hamano <[email protected]> on Fri, 2014/12/12 12:33:

Quoted 9 lines

After queuing these three, I _think_ it is better to have something like this patch on top, as it is distracting to let the GPG message while setting up the test gpghome leak into the test output, especially without running these tests with "-v" option.

The splitting of RFC1991 prerequiste part is about future-proofing. When we want to define other kinds of specific prerequisites in the future, I'd prefer to see it done separately from the basic set-up code.

Sounds reasonable and looks good to me. So...

Thanks!

Quoted 47 lines
 t/lib-gpg.sh | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
t/lib-gpg.sh +8 -10
index b611b78..33de402 100755
@@ -16,23 +16,25 @@ else
 		# Type DSA and Elgamal, size 2048 bits, no expiration date.
 		# Name and email: C O Mitter <[email protected]>
 		# No password given, to enable non-interactive operation.
-		mkdir ./gpghome
-		chmod 0700 ./gpghome
-		GNUPGHOME="$(pwd)/gpghome"
-		export GNUPGHOME
-		gpg --homedir "${GNUPGHOME}" --import \
-			"$TEST_DIRECTORY"/lib-gpg/keyring.gpg
-		gpg --homedir "${GNUPGHOME}" --import-ownertrust \
-			"$TEST_DIRECTORY"/lib-gpg/ownertrust
+		mkdir ./gpghome &&
+		chmod 0700 ./gpghome &&
+		GNUPGHOME="$(pwd)/gpghome" &&
+		export GNUPGHOME &&
+		gpg --homedir "${GNUPGHOME}" 2>/dev/null --import \
+			"$TEST_DIRECTORY"/lib-gpg/keyring.gpg &&
+		gpg --homedir "${GNUPGHOME}" 2>/dev/null
--import-ownertrust \
+			"$TEST_DIRECTORY"/lib-gpg/ownertrust &&
 		test_set_prereq GPG
-		if echo | gpg --homedir "${GNUPGHOME}" -b --rfc1991
Quoted 1 line

/dev/null 2>&1

t/lib-gpg.sh +6 -3
-		then
-			test_set_prereq RFC1991
-		fi
 		;;
 	esac
 fi
 
+if test_have_prereq GPG &&
+    echo | gpg --homedir "${GNUPGHOME}" -b --rfc1991 >/dev/null 2>&1
+then
+	test_set_prereq RFC1991
+fi
+
 sanitize_pgp() {
 	perl -ne '
 		/^-----END PGP/ and $in_pgp = 0;
Signature · 2 lines
Best regards,
Chris