Skip to content

Commit

Permalink
tests: Add coverage for key Ed comparison
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Jelen <[email protected]>
  • Loading branch information
Jakuje committed Apr 16, 2024
1 parent 1eb745c commit 532d777
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/setup-softhsm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,14 @@ pkcs11-tool --keypairgen --key-type="EC:edwards25519" --login --pin=$PINVALUE --
--label="${EDCRTN}" --id="$KEYID"
ca_sign $EDCRT $EDCRTN "My ED25519 Cert" $KEYID

EDBASEURIWITHPIN="pkcs11:id=${URIKEYID};pin-value=${PINVALUE}"
EDBASEURI="pkcs11:id=${URIKEYID}"
EDPUBURI="pkcs11:type=public;id=${URIKEYID}"
EDPRIURI="pkcs11:type=private;id=${URIKEYID}"
EDCRTURI="pkcs11:type=cert;object=${EDCRTN}"

title LINE "ED25519 PKCS11 URIS"
echo "${EDBASEURIWITHPIN}"
echo "${EDBASEURI}"
echo "${EDPUBURI}"
echo "${EDPRIURI}"
Expand Down Expand Up @@ -407,6 +409,7 @@ export ECPEERPUBURI="${ECPEERPUBURI}"
export ECPEERPRIURI="${ECPEERPRIURI}"
export ECPEERCRTURI="${ECPEERCRTURI}"
export EDBASEURIWITHPIN="${EDBASEURIWITHPIN}"
export EDBASEURI="${EDBASEURI}"
export EDPUBURI="${EDPUBURI}"
export EDPRIURI="${EDPRIURI}"
Expand Down
2 changes: 2 additions & 0 deletions tests/tbasic
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,13 @@ OPENSSL_CONF=${OPENSSL_CONF}.nopin
ossl 'pkey -in $PUBURI -pubin -pubout -out ${TMPPDIR}/rsa.pub.nopin.pem'
ossl 'pkey -in $ECPUBURI -pubin -pubout -out ${TMPPDIR}/ec.pub.nopin.pem'
[[ -n $ECXPUBURI ]] && ossl 'pkey -in $ECXPUBURI -pubin -pubout -out ${TMPPDIR}/ecx.pub.nopin.pem'
[[ -n $EDPUBURI ]] && ossl 'pkey -in $EDPUBURI -pubin -pubout -out ${TMPPDIR}/ed.pub.nopin.pem'

title PARA "Test fetching public keys with a PIN in URI"
ossl 'pkey -in $BASEURIWITHPIN -pubin -pubout -out ${TMPPDIR}/rsa.pub.uripin.pem'
ossl 'pkey -in $ECBASEURIWITHPIN -pubin -pubout -out ${TMPPDIR}/ec.pub.uripin.pem'
[[ -n $ECXBASEURIWITHPIN ]] && ossl 'pkey -in $ECXBASEURIWITHPIN -pubin -pubout -out ${TMPPDIR}/ecx.pub.uripin.pem'
[[ -n $EDBASEURIWITHPIN ]] && ossl 'pkey -in $EDBASEURIWITHPIN -pubin -pubout -out ${TMPPDIR}/ed.pub.uripin.pem'

title PARA "Test prompting without PIN in config files"
output=$(expect -c "spawn -noecho $CHECKER openssl pkey -in \"${PRIURI}\" -text -noout;
Expand Down
3 changes: 3 additions & 0 deletions tests/tedwards
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ req -new -batch -key "${EDPRIURI}" -out ${TMPPDIR}/ed25519_csr.pem'
ossl '
req -in ${TMPPDIR}/ed25519_csr.pem -verify -noout'

title PARA "Test EVP_PKEY_eq on public Edwards key both on token"
$CHECKER ./tcmpkeys "$EDPUBURI" "$EDPUBURI"

title PARA "Test EVP_PKEY_eq on public ED key via import"
$CHECKER ./tcmpkeys "$EDPUBURI" "${TMPPDIR}"/edout.pub
title PARA "Match private ED key against public key"
Expand Down

0 comments on commit 532d777

Please sign in to comment.