Commit 19a7be76 authored by Niels Möller's avatar Niels Möller
Browse files

(test_valid, test_invalid):

Optionally take three arguments, where the second is the data
being signed. Added two new tests, with correct and incorrect
input for the RSA signature verification.

Rev: src/spki/testsuite/check-signature-test:1.6
parent 40b0e3ed
......@@ -9,13 +9,40 @@ die () {
exit 1
}
test_valid () {
../tools/spki-check-signature "`conv "$2"`" || die "$1"
test_valid () {
name="$1"
shift
if [ $# = 2 ] ; then
msg="$1"
flags=""
shift
else
msg=""
flags="--no-data"
fi
sign="$1"
# echo $msg : ../tools/spki-check-signature $flags "`conv "$sign"`"
echo "$msg" | ../tools/spki-check-signature $flags "`conv "$sign"`" \
|| die "$name"
}
test_invalid () {
if ../tools/spki-check-signature "`conv "$2"`"
then die "$1"
name="$1"
shift
if [ $# = 2 ] ; then
msg="$1"
flags=""
shift
else
msg=""
flags="--no-data"
fi
sign="$1"
# echo $msg : ../tools/spki-check-signature $flags "`conv "$sign"`"
if echo "$msg" | ../tools/spki-check-signature $flags "`conv "$sign"`"
then die "$name"
fi
}
......@@ -59,6 +86,26 @@ test_invalid "valid rsa, too short hash" '
(rsa-pkcs1-sha1 |AsI2rx8wZmfYRGsUDfzcq3ycWWNThNP3NmU07Y7rONR2
xaHDqfwpm5n+j3kzToBxyWQb+5G7mqXZBPfwlpGJ|))'
test_valid "valid rsa, with message" "foo" '
(signature (hash sha1
|8dLS+STphqyG/fezbJS83zK+7BU=|)
(public-key (rsa-pkcs1-sha1 (n |CijcTD4ZSRQtpqa9nLT2rVFtkPFIu
Daxy8FShFh2LLQhSpONFObSR30MXm
KFLgi8vn7RQyqn85bLbqbkRahR|)
(e |J4NiEw==|)))
(rsa-pkcs1-sha1 |AsI2rx8wZmfYRGsUDfzcq3ycWWNThNP3NmU07Y7rONR2
xaHDqfwpm5n+j3kzToBxyWQb+5G7mqXZBPfwlpGJ|))'
test_invalid "rsa, with invalid message" "bar" '
(signature (hash sha1
|8dLS+STphqyG/fezbJS83zK+7BU=|)
(public-key (rsa-pkcs1-sha1 (n |CijcTD4ZSRQtpqa9nLT2rVFtkPFIu
Daxy8FShFh2LLQhSpONFObSR30MXm
KFLgi8vn7RQyqn85bLbqbkRahR|)
(e |J4NiEw==|)))
(rsa-pkcs1-sha1 |AsI2rx8wZmfYRGsUDfzcq3ycWWNThNP3NmU07Y7rONR2
xaHDqfwpm5n+j3kzToBxyWQb+5G7mqXZBPfwlpGJ|))'
test_valid "valid dsa" '
(signature
(hash sha1 |UNGhcpNFWg5UhtoV2yxV6wPMJPA=|)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment