summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/cert-tests/crl15
-rwxr-xr-xtests/cert-tests/crq13
-rw-r--r--tests/cert-tests/data/key-corpus-rc2-1.p12.out7
-rwxr-xr-xtests/cert-tests/pem-decoding42
-rwxr-xr-xtests/cert-tests/pkcs1213
-rwxr-xr-xtests/cert-tests/pkcs715
-rwxr-xr-xtests/cert-tests/privkey-import16
7 files changed, 120 insertions, 1 deletions
diff --git a/tests/cert-tests/crl b/tests/cert-tests/crl
index f1d1c9683c..15fa44b844 100755
--- a/tests/cert-tests/crl
+++ b/tests/cert-tests/crl
@@ -39,6 +39,7 @@ OUTFILE=out-crl.$$.tmp
INFOFILE=out-crl-info.$$.tmp
OUTFILE2=out2-crl.$$.tmp
TMPFILE=crl.$$.tmpl
+TMP2FILE=crl.$$.tmp2
echo "crl_next_update = 43" >$TMPFILE
echo "crl_number = 7" >>$TMPFILE
@@ -54,6 +55,19 @@ if test "${rc}" != "0"; then
exit ${rc}
fi
+${VALGRIND} "${CERTTOOL}" --crl-info --infile ${OUTFILE} --no-text >${TMP2FILE}
+rc=$?
+
+if test "${rc}" != "0"; then
+ echo "--no-text crl info failed 1"
+ exit ${rc}
+fi
+
+if grep -v '^-----BEGIN [A-Z0-9 ]\+-----$\|^[A-Za-z0-9/+=]\+$\|^-----END [A-Z0-9 ]\+-----$' ${TMP2FILE} ; then
+ echo "--no-text crl info failed 2"
+ exit 1
+fi
+
grep "Revoked certificates (152)" "${INFOFILE}" >/dev/null 2>&1
if test "$?" != "0"; then
echo "CRL generation didn't succeed as expected"
@@ -289,5 +303,6 @@ rm -f "${OUTFILE}"
rm -f "${INFOFILE}"
rm -f "${OUTFILE2}"
rm -f "${TMPFILE}"
+rm -f "${TMP2FILE}"
exit 0
diff --git a/tests/cert-tests/crq b/tests/cert-tests/crq
index 3edc004d6b..2c59930fef 100755
--- a/tests/cert-tests/crq
+++ b/tests/cert-tests/crq
@@ -66,6 +66,19 @@ datefudge -s "2007-04-22" \
--template "${srcdir}/templates/template-tlsfeature.tmpl" \
--outfile $OUTFILE 2>/dev/null
+${CERTTOOL} --crq-info --no-text --infile ${OUTFILE} > ${TMPFILE}
+rc=$?
+
+if test "${rc}" != "0"; then
+ echo "--no-text crq 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 crq info failed 2"
+ exit 1
+fi
+
datefudge -s "2007-04-22" \
"${CERTTOOL}" --generate-certificate \
--load-ca-privkey "${srcdir}/data/template-test.key" \
diff --git a/tests/cert-tests/data/key-corpus-rc2-1.p12.out b/tests/cert-tests/data/key-corpus-rc2-1.p12.out
index 534b796546..1781059233 100644
--- a/tests/cert-tests/data/key-corpus-rc2-1.p12.out
+++ b/tests/cert-tests/data/key-corpus-rc2-1.p12.out
@@ -5,8 +5,14 @@ MAC info:
Iteration count: 2048
BAG #0
+ Type: Encrypted
+ Schema: unsupported (1.2.840.113549.1.5.13)
+
+ Decrypting...
+
BAG #1
Elements: 1
+ Type: PKCS #8 Encrypted key
PKCS #8 information:
Schema: unsupported (1.2.840.113549.1.5.13/1.2.840.113549.3.2)
Friendly name: localhost
@@ -41,4 +47,3 @@ XPvobYe2HqIYKwkDOpP9wX7ClCiPoOlt7VKMuBJQy/1JFC6DRA7oBYmcZbZxw2uo
j/dC2cK5jsPC75a5+8HqySwQGlBGxlMOeyi/pKzSdWOdZ9NEshvTje/mnme3Hx05
JWamOc7reYsFpA==
-----END ENCRYPTED PRIVATE KEY-----
-
diff --git a/tests/cert-tests/pem-decoding b/tests/cert-tests/pem-decoding
index 0222ae72af..7419656d02 100755
--- a/tests/cert-tests/pem-decoding
+++ b/tests/cert-tests/pem-decoding
@@ -179,6 +179,48 @@ if test "${rc}" != "0"; then
exit ${rc}
fi
+#check if --no-text works as expected
+${VALGRIND} "${CERTTOOL}" --certificate-info --infile "${srcdir}/data/cert-ecc256.pem" --no-text >${TMPFILE}
+rc=$?
+
+if test "${rc}" != "0"; then
+ echo "--no-text -k --certificate-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 -k --certificate-info failed 2"
+ exit 1
+fi
+
+#check if --no-text works as expected
+${VALGRIND} "${CERTTOOL}" --certificate-pubkey --infile "${srcdir}/data/cert-ecc256.pem" --no-text >${TMPFILE}
+rc=$?
+
+if test "${rc}" != "0"; then
+ echo "--no-text cert pubkey 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 cert pubkey failed 2"
+ exit 1
+fi
+
+#check if --no-text works as expected
+${VALGRIND} "${CERTTOOL}" --pubkey-info --infile "${srcdir}/data/cert-ecc256.pem" --no-text >${TMPFILE}
+rc=$?
+
+if test "${rc}" != "0"; then
+ echo "--no-text pubkey 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 pubkey info failed 2"
+ exit 1
+fi
+
rm -f ${TMPFILE} ${TMPFILE1} ${TMPFILE2}
exit 0
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
diff --git a/tests/cert-tests/privkey-import b/tests/cert-tests/privkey-import
index 6eaa237836..afac285463 100755
--- a/tests/cert-tests/privkey-import
+++ b/tests/cert-tests/privkey-import
@@ -23,6 +23,7 @@
srcdir="${srcdir:-.}"
CERTTOOL="${CERTTOOL:-../../src/certtool${EXEEXT}}"
DIFF="${DIFF:-diff}"
+TMPFILE=tmp-$$.privkey.tmp
if ! test -x "${CERTTOOL}"; then
exit 77
@@ -43,4 +44,19 @@ if test "${rc}" != "0";then
fi
done
+${VALGRIND} "${CERTTOOL}" -k --infile "${srcdir}/data/privkey1.pem" --no-text >${TMPFILE}
+rc=$?
+
+if test "${rc}" != "0"; then
+ echo "--no-text privkey 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 privkey info failed 2"
+ exit 1
+fi
+
+rm -f ${TMPFILE}
+
exit 0