From 8519141e5ee46dcac44221de39c76d0def5a0088 Mon Sep 17 00:00:00 2001 From: Jonathan McDowell Date: Fri, 15 Sep 2023 15:39:58 +0530 Subject: [PATCH] Add a test for signature verification Test signature verification by adding my new ECC key with verification enabled, which will strip all signatures, then adding my old RSA key, then readding my ECC key. This should result in the ECC key having a signature from my old RSA key. --- keys/README | 4 +++- keys/noodles-ecc.key | Bin 0 -> 4911 bytes t/all-037-check-sigs.t | 31 +++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 keys/noodles-ecc.key create mode 100755 t/all-037-check-sigs.t diff --git a/keys/README b/keys/README index 2244d3e..8df4a8e 100644 --- a/keys/README +++ b/keys/README @@ -15,7 +15,9 @@ blackcat.key autodns.key A v4 DSA/Elg key. noodles.key - My v4 DSA/Elg key. + My v4 RSA key. +noodles-ecc.key + My v4 ECC ED25519 key. putro.key A v4 key with a non revocation signature on the public key. huggie-rev.key diff --git a/keys/noodles-ecc.key b/keys/noodles-ecc.key new file mode 100644 index 0000000000000000000000000000000000000000..1adafd6ba95a597f01e733e197c19f55cd1dd77f GIT binary patch literal 4911 zcmaKvWl$9E+J|?Sg{8X@kPsvUDG?E*OHxD-LD{7ic1b}>5LgzFPU(^cDT$?FX-P@x zjz1~g@ya=`bIzyp^*8g(^P79Fx$n8+MZjkB@tw2;e0V@Ga8j8J2!zP!ee3fw&-HY$ zg$%thX8jpHPorMguj9#hhb*f3cx0lff>X`T7U~3t+TPVLRj_k0MuASNI#0Zxl0 z0GEgWAA*BRLr8#6gi8y;0RliQKoFfbfRKRv?~_1Xz$Gzymx+vX@T9uu)bQYv^|IEs z+oK;zpK#G^p3`;Fo&&h~SmlK?q?`=+BKJfa8EICl_1hRWO2l5=4wCOtW9S5a28n>l zfrJ3&KgHZxE4h;bN1u-zasZAV71&cS>(l-zwqe|N`|sZ*=MmYBUCbHh5~@WxShnMt zZ#~B!GwUgmgU)*oli9Gk>xUJ zyX7yNIR&hJL0yS>eng_9Z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#0&afYlJUjkG0K2tGqh$opA^?CZA8D*N2Y1)t{5;ZRAzwpO0bMPUHOju=ipDJh~4rnLIh$sBIJ#t7)+WqYD^HnaGi>GZvvfP zTiKk{@tP5^_*P(j*4E`L?U9fq+rb_gwzgxxJ;f->a87Oo0IoY zTG2AC0rb3vmO6UhrEa>PrzhWWqs9Y2lk(p9`RP-gKo&fxAKP4Dkk695O6wo%7G;NB zb2zDFta$n`_(e<_NmF2wMChHN7#2p>Mb~T~AZcbAA$KT!qEjrp#6Uqb9GgYhHK63b vw@3ebrVf1{2XIAQO_C|P@Kz~pytEXO9u};1fP+xR!~1DFY?^17gNO5f)-XAV literal 0 HcmV?d00001 diff --git a/t/all-037-check-sigs.t b/t/all-037-check-sigs.t new file mode 100755 index 0000000..ed02c23 --- /dev/null +++ b/t/all-037-check-sigs.t @@ -0,0 +1,31 @@ +#!/bin/sh +# Check that signatures are only added when they can be verified + +set -e + +cd ${WORKDIR} +cp $1 check-sigs.ini + +trap cleanup exit +cleanup () { + rm check-sigs.ini +} +echo verify_signatures=true >> check-sigs.ini + +${BUILDDIR}/onak -b -c check-sigs.ini add < ${TESTSDIR}/../keys/noodles-ecc.key || true +if ${BUILDDIR}/onak -c $1 vindex 0x9026108FB942BEA4 2>&1 | \ + grep -q '0x94FA372B2DA8B985'; then + echo "* Did not correctly strip unknown signatures" + exit 1 +fi + +${BUILDDIR}/onak -b -c check-sigs.ini add < ${TESTSDIR}/../keys/noodles.key || true + +${BUILDDIR}/onak -b -c check-sigs.ini add < ${TESTSDIR}/../keys/noodles-ecc.key || true +if ! ${BUILDDIR}/onak -c $1 vindex 0x9026108FB942BEA4 2>&1 | \ + grep -q '0x94FA372B2DA8B985'; then + echo "* Did not correctly verify new signature" + exit 1 +fi + +exit 0 -- 2.39.5