git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 01/10] Add Testcases for time-stamping functionality

From
AWAnton Wuerfel <anton.wuerfel@fau.de>
Date
Mar 17, 2016, 18:46 UTC
Message-ID
<1458240421-3593-2-git-send-email-anton.wuerfel@fau.de>
In-Reply-To
<1458240421-3593-1-git-send-email-anton.wuerfel@fau.de>

This commit adds testcases for the new time-stamping functionality. To trigger these testcases, the environment variables $GIT_TEST_TSA_URL and $GIT_TEST_TSA_CAPATH have to be set. They do not default to any value to avoid spamming a pre-defined Time Stamping Authority (TSA). As testing the RFC3161 functionality without a trusted time-stamp signature is not possible, all tests are disabled by default.

Signed-off-by: Anton Würfel <anton.wuerfel@fau.de>
Signed-off-by: Phillip Raffeck <phillip.raffeck@fau.de>
---
 t/t7031-verify-tag.sh | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)
 create mode 100755 t/t7031-verify-tag.sh
diff --git a/t/t7031-verify-tag.sh b/t/t7031-verify-tag.sh
new file mode 100755
index 0000000..bc7953b
--- /dev/null
+++ b/t/t7031-verify-tag.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+test_description='signed time-stamped tag tests'
+. ./test-lib.sh
+. "$TEST_DIRECTORY/lib-gpg.sh"
+
+# Tests for RFC3161 implementation
+
+if test -n "$NO_OPENSSL"
+then
+	skip_all='skipping test, git built without openssl support'
+	test_done
+fi
+
+# Disable remote tests by default to avoid spamming of TSAs and to be able to
+# test without internet connection
+
+if test -z "$GIT_TEST_TSA_URL"
+then
+	skip_all='Remote TSA testing disabled (set GIT_TEST_TSA_URL to enable)'
+	test_done
+fi
+
+if test -z "$GIT_TEST_TSA_CAPATH"
+then
+	skip_all='Remote TSA testing disabled (set GIT_TEST_TSA_CAPATH to enable)'
+	test_done
+fi
+
+test_expect_success 'create a tag with a timestamp signature' '
+	git config ts.tsaurl $GIT_TEST_TSA_URL &&
+	git config ts.capath $GIT_TEST_TSA_CAPATH &&
+	git config ts.failonverify 1 &&
+	test_tick &&
+	echo foo > foo &&
+	git add foo &&
+	git commit -m foo &&
+	git tag -t -m onlytime tsa_onlytime
+'
+
+test_expect_success GPG 'create a tag with gpg and timestamp signatures' '
+	echo foobar > bar &&
+	git add bar &&
+	git commit -m test123 &&
+	git tag -s -t -m tsa_both tsa_both
+'
+
+test_expect_success 'verify tag with gpg and timestamp signature' '
+	git verify-tag tsa_both
+'
+
+test_expect_success 'verify tag with timestamp signature' '
+	test_must_fail git verify-tag tsa_onlytime
+'
+
+test_expect_success 'verify tag with timestamp signature with -t' '
+	git verify-tag -t tsa_onlytime
+'
+
+test_expect_success 'verify fudged timestamp' '
+	git cat-file tag tsa_onlytime >raw &&
+	sed -e "s/onlytime/morethantime/" raw >forged1 &&
+	git hash-object -w -t tag forged1 >forged1.tag &&
+	test_must_fail git verify-tag $(cat forged1.tag) >actual1 2>&1 &&
+	grep "BAD time-stamp signature" actual1 &&
+	! grep "Verified timestamp" actual1
+'
+
+test_done
-- 
2.8.0.rc0.62.gfc8aefa.dirty
Previous: Anton WuerfelNext: Anton Wuerfel
Message 2 of 11 in “Adding RFC3161 time-stamps to tags”
  1. 00/10 Adding RFC3161 time-stamps to tagsAnton Wuerfel, Mar 17, 2016
  2. 01/10 Add Testcases for time-stamping functionalityAnton Wuerfel, Mar 17, 2016
  3. 02/10 Documentation for time-stamping functionalityAnton Wuerfel, Mar 17, 2016
  4. 03/10 Documentation: Whitespace fixAnton Wuerfel, Mar 17, 2016
  5. 04/10 Extending internal CURL wrapper for POST uploadAnton Wuerfel, Mar 17, 2016
  6. 05/10 Make PGP macros globalAnton Wuerfel, Mar 17, 2016
  7. 06/10 Add basic RFC3161 functionalityAnton Wuerfel, Mar 17, 2016
  8. 07/10 Add git-http-timestamp helper toolAnton Wuerfel, Mar 17, 2016
  9. 08/10 Adding time-stamping helper toolAnton Wuerfel, Mar 17, 2016
  10. 09/10 Add time-stamping functionality to git verify-tagAnton Wuerfel, Mar 17, 2016
  11. 10/10 Add time-stamping functionality to git tagAnton Wuerfel, Mar 17, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.