summaryrefslogtreecommitdiff
path: root/tests/cert-tests/certtool-rsa-pss
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cert-tests/certtool-rsa-pss')
-rwxr-xr-xtests/cert-tests/certtool-rsa-pss33
1 files changed, 32 insertions, 1 deletions
diff --git a/tests/cert-tests/certtool-rsa-pss b/tests/cert-tests/certtool-rsa-pss
index f8126a5523..baa819c6ac 100755
--- a/tests/cert-tests/certtool-rsa-pss
+++ b/tests/cert-tests/certtool-rsa-pss
@@ -49,7 +49,7 @@ if test "${rc}" != "0"; then
exit 1
fi
-${VALGRIND} "${CERTTOOL}" -k --password '' --infile "$OUTFILE"
+${VALGRIND} "${CERTTOOL}" -k --password '' --infile "$OUTFILE" >/dev/null
rc=$?
if test "${rc}" != "0"; then
echo "Could not read generated an RSA-PSS key ($i)"
@@ -68,6 +68,8 @@ if test "${rc}" != "0"; then
exit 1
fi
+rm -f "${TMPFILE}"
+
# Create an RSA-PSS certificate from an RSA-PSS private key, with
# mismatched parameters
for j in sha256 sha384 sha512;do
@@ -82,6 +84,7 @@ if test "$j" != "$j" && "${rc}" = "0"; then
exit 1
fi
done
+rm -f "${TMPFILE}"
# Create an RSA-PSS certificate from an RSA key
${VALGRIND} "${CERTTOOL}" --generate-certificate --key-type rsa-pss \
@@ -97,6 +100,15 @@ if test "${rc}" != "0"; then
exit 1
fi
+${CERTTOOL} -i --infile ${TMPFILE}|grep -i "Subject Public Key Algorithm: RSA-PSS"
+if test $? != 0;then
+ echo "Generated certificate is not RSA-PSS"
+ cat ${TMPFILE}
+ exit 1
+fi
+
+rm -f "${TMPFILE}"
+
# Create an RSA certificate from an RSA key, and sign it with RSA-PSS
${VALGRIND} "${CERTTOOL}" --generate-certificate --rsa --sign-params rsa-pss \
--load-privkey "${srcdir}/../../doc/credentials/x509/key-rsa.pem" \
@@ -110,6 +122,23 @@ if test "${rc}" != "0"; then
echo "Could not generate an RSA-PSS certificate"
exit 1
fi
+
+${CERTTOOL} -i --infile ${TMPFILE}|tr -d '\r'|grep -i 'Subject Public Key Algorithm: RSA$' >/dev/null
+if test $? != 0;then
+ echo "Generated certificate is not RSA"
+ cat ${TMPFILE}
+ exit 1
+fi
+
+${CERTTOOL} -i --infile ${TMPFILE}|grep -i "Signature Algorithm: RSA-PSS"
+if test $? != 0;then
+ echo "Generated certificate is not signed with RSA-PSS"
+ cat ${TMPFILE}
+ exit 1
+fi
+
+rm -f "${TMPFILE}"
+
done
# Convert an RSA-PSS key to an RSA key
@@ -133,6 +162,8 @@ fi
echo "RSA-PSS to RSA conversion was successful"
+rm -f "${TMPFILE}"
+
export TZ="UTC"
. ${srcdir}/../scripts/common.sh