From d2c6553ed15ef5327e9f7179e7f4fbdfa1ae4169 Mon Sep 17 00:00:00 2001 From: Dmitry Eremin-Solenikov Date: Wed, 21 Nov 2018 18:35:07 +0300 Subject: cert-tests: verify --no-text switch for pkcs7/pkcs12 info Signed-off-by: Dmitry Eremin-Solenikov --- tests/cert-tests/pkcs12 | 13 +++++++++++++ tests/cert-tests/pkcs7 | 15 +++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/tests/cert-tests/pkcs12 b/tests/cert-tests/pkcs12 index 12049c8fd0..d05389d10f 100755 --- a/tests/cert-tests/pkcs12 +++ b/tests/cert-tests/pkcs12 @@ -80,6 +80,19 @@ if test ${rc} != 0; then exit 1 fi +${VALGRIND} "${CERTTOOL}" --p12-info --inder --password 1234 --infile "$srcdir/data/sha256.p12" --outfile "${TMPFILE}" --no-text +rc=$? + +if test "${rc}" != "0"; then + echo "--no-text pkcs12 info failed 1" + exit ${rc} +fi + +if grep -v '^-----BEGIN [A-Z0-9 ]\+-----$\|^[A-Za-z0-9/+=]\+$\|^-----END [A-Z0-9 ]\+-----$' ${TMPFILE} ; then + echo "--no-text pkcs12 info failed 2" + exit 1 +fi + # test whether we can encode a certificate and a key ${VALGRIND} "${CERTTOOL}" --to-p12 --password 1234 --p12-name "my-key" --load-certificate "${srcdir}/../certs/cert-ecc256.pem" --load-privkey "${srcdir}/../certs/ecc256.pem" --outder --outfile $TMPFILE >/dev/null rc=$? diff --git a/tests/cert-tests/pkcs7 b/tests/cert-tests/pkcs7 index 48192985ec..bfe11290fc 100755 --- a/tests/cert-tests/pkcs7 +++ b/tests/cert-tests/pkcs7 @@ -34,6 +34,7 @@ fi OUTFILE=out-pkcs7.$$.tmp OUTFILE2=out2-pkcs7.$$.tmp +TMPFILE=tmp-pkcs7.$$.tmp . ${srcdir}/../scripts/common.sh @@ -63,6 +64,19 @@ if test "$?" != "0"; then fi done +${VALGRIND} "${CERTTOOL}" --inder --p7-info --infile "${srcdir}/data/full.p7b" --outfile "${TMPFILE}" --no-text +rc=$? + +if test "${rc}" != "0"; then + echo "--no-text pkcs7 info failed 1" + exit ${rc} +fi + +if grep -v '^-----BEGIN [A-Z0-9 ]\+-----$\|^[A-Za-z0-9/+=]\+$\|^-----END [A-Z0-9 ]\+-----$' ${TMPFILE} ; then + echo "--no-text pkcs7 info failed 2" + exit 1 +fi + # check signatures for FILE in full.p7b openssl.p7b openssl-keyid.p7b; do @@ -324,5 +338,6 @@ fi rm -f "${OUTFILE}" rm -f "${OUTFILE2}" +rm -f "${TMPFILE}" exit 0 -- cgit v1.2.1