diff options
author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2018-11-21 18:35:07 +0300 |
---|---|---|
committer | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2018-11-26 16:56:34 +0300 |
commit | d2c6553ed15ef5327e9f7179e7f4fbdfa1ae4169 (patch) | |
tree | 8bdf48997abe1ed5f51f2f4240c2c92bf0718807 | |
parent | 2e6f022fda292eeedfb1289aa1593af4a31f77b6 (diff) | |
download | gnutls-d2c6553ed15ef5327e9f7179e7f4fbdfa1ae4169.tar.gz |
cert-tests: verify --no-text switch for pkcs7/pkcs12 info
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
-rwxr-xr-x | tests/cert-tests/pkcs12 | 13 | ||||
-rwxr-xr-x | tests/cert-tests/pkcs7 | 15 |
2 files changed, 28 insertions, 0 deletions
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 |