diff options
Diffstat (limited to 'security/nss/tests')
21 files changed, 181 insertions, 2 deletions
diff --git a/security/nss/tests/cert/cert.sh b/security/nss/tests/cert/cert.sh index d7ec101fa7..67951f6e43 100755 --- a/security/nss/tests/cert/cert.sh +++ b/security/nss/tests/cert/cert.sh @@ -2607,8 +2607,40 @@ cert_cleanup() . common/cleanup.sh } +CERTCACHE=${TESTDIR}/${HOST}.${TEST_MODE}.cert.cache.tar.gz + +cert_make_cache() +{ + if [ -n "${NSS_USE_CERT_CACHE}" ] ; then + pushd ${HOSTDIR} + tar czf "${CERTCACHE}" . + popd + fi +} + +cert_use_cache() +{ + if [ -n "${NSS_USE_CERT_CACHE}" ] ; then + pushd ${HOSTDIR} + if [ -r "${CERTCACHE}" ]; then + tar xzf "${CERTCACHE}" + return 1; + fi + popd + fi + + rm "${CERTCACHE}" + return 0; +} + ################## main ################################################# +cert_use_cache +USING_CACHE=$? +if [[ $USING_CACHE -eq 1 ]]; then + return 0; +fi + cert_init cert_all_CA cert_test_implicit_db_init @@ -2648,3 +2680,4 @@ fi cert_iopr_setup cert_cleanup +cert_make_cache diff --git a/security/nss/tests/smime/interop-openssl/Fran-ec.p12 b/security/nss/tests/smime/interop-openssl/Fran-ec.p12 Binary files differnew file mode 100644 index 0000000000..75c69220f9 --- /dev/null +++ b/security/nss/tests/smime/interop-openssl/Fran-ec.p12 diff --git a/security/nss/tests/smime/interop-openssl/Fran.p12 b/security/nss/tests/smime/interop-openssl/Fran.p12 Binary files differnew file mode 100644 index 0000000000..65b1d4e1b8 --- /dev/null +++ b/security/nss/tests/smime/interop-openssl/Fran.p12 diff --git a/security/nss/tests/smime/interop-openssl/fran-ec_ossl-aes128-sha1.env b/security/nss/tests/smime/interop-openssl/fran-ec_ossl-aes128-sha1.env Binary files differnew file mode 100644 index 0000000000..e3de11b926 --- /dev/null +++ b/security/nss/tests/smime/interop-openssl/fran-ec_ossl-aes128-sha1.env diff --git a/security/nss/tests/smime/interop-openssl/fran-ec_ossl-aes128-sha224.env b/security/nss/tests/smime/interop-openssl/fran-ec_ossl-aes128-sha224.env Binary files differnew file mode 100644 index 0000000000..6faabecfb0 --- /dev/null +++ b/security/nss/tests/smime/interop-openssl/fran-ec_ossl-aes128-sha224.env diff --git a/security/nss/tests/smime/interop-openssl/fran-ec_ossl-aes128-sha256.env b/security/nss/tests/smime/interop-openssl/fran-ec_ossl-aes128-sha256.env Binary files differnew file mode 100644 index 0000000000..4ec30c677d --- /dev/null +++ b/security/nss/tests/smime/interop-openssl/fran-ec_ossl-aes128-sha256.env diff --git a/security/nss/tests/smime/interop-openssl/fran-ec_ossl-aes192-sha384.env b/security/nss/tests/smime/interop-openssl/fran-ec_ossl-aes192-sha384.env Binary files differnew file mode 100644 index 0000000000..113caa87a4 --- /dev/null +++ b/security/nss/tests/smime/interop-openssl/fran-ec_ossl-aes192-sha384.env diff --git a/security/nss/tests/smime/interop-openssl/fran-ec_ossl-aes256-sha512.env b/security/nss/tests/smime/interop-openssl/fran-ec_ossl-aes256-sha512.env Binary files differnew file mode 100644 index 0000000000..2d797d0330 --- /dev/null +++ b/security/nss/tests/smime/interop-openssl/fran-ec_ossl-aes256-sha512.env diff --git a/security/nss/tests/smime/interop-openssl/fran-oaep-label_ossl.env b/security/nss/tests/smime/interop-openssl/fran-oaep-label_ossl.env Binary files differnew file mode 100644 index 0000000000..0c35d4d7ae --- /dev/null +++ b/security/nss/tests/smime/interop-openssl/fran-oaep-label_ossl.env diff --git a/security/nss/tests/smime/interop-openssl/fran-oaep-sha256hash-label_ossl.env b/security/nss/tests/smime/interop-openssl/fran-oaep-sha256hash-label_ossl.env Binary files differnew file mode 100644 index 0000000000..0871ccf7ad --- /dev/null +++ b/security/nss/tests/smime/interop-openssl/fran-oaep-sha256hash-label_ossl.env diff --git a/security/nss/tests/smime/interop-openssl/fran-oaep-sha256hash-sha256mgf_ossl.env b/security/nss/tests/smime/interop-openssl/fran-oaep-sha256hash-sha256mgf_ossl.env Binary files differnew file mode 100644 index 0000000000..17b1a1706f --- /dev/null +++ b/security/nss/tests/smime/interop-openssl/fran-oaep-sha256hash-sha256mgf_ossl.env diff --git a/security/nss/tests/smime/interop-openssl/fran-oaep-sha256hash_ossl.env b/security/nss/tests/smime/interop-openssl/fran-oaep-sha256hash_ossl.env Binary files differnew file mode 100644 index 0000000000..3fd8bd04bb --- /dev/null +++ b/security/nss/tests/smime/interop-openssl/fran-oaep-sha256hash_ossl.env diff --git a/security/nss/tests/smime/interop-openssl/fran-oaep-sha256mgf-label_ossl.env b/security/nss/tests/smime/interop-openssl/fran-oaep-sha256mgf-label_ossl.env Binary files differnew file mode 100644 index 0000000000..c92f3c5b78 --- /dev/null +++ b/security/nss/tests/smime/interop-openssl/fran-oaep-sha256mgf-label_ossl.env diff --git a/security/nss/tests/smime/interop-openssl/fran-oaep-sha256mgf_ossl.env b/security/nss/tests/smime/interop-openssl/fran-oaep-sha256mgf_ossl.env Binary files differnew file mode 100644 index 0000000000..875d4c243f --- /dev/null +++ b/security/nss/tests/smime/interop-openssl/fran-oaep-sha256mgf_ossl.env diff --git a/security/nss/tests/smime/interop-openssl/fran-oaep-sha384hash_ossl.env b/security/nss/tests/smime/interop-openssl/fran-oaep-sha384hash_ossl.env Binary files differnew file mode 100644 index 0000000000..07d4743325 --- /dev/null +++ b/security/nss/tests/smime/interop-openssl/fran-oaep-sha384hash_ossl.env diff --git a/security/nss/tests/smime/interop-openssl/fran-oaep-sha384mgf_ossl.env b/security/nss/tests/smime/interop-openssl/fran-oaep-sha384mgf_ossl.env Binary files differnew file mode 100644 index 0000000000..61e80d3fcd --- /dev/null +++ b/security/nss/tests/smime/interop-openssl/fran-oaep-sha384mgf_ossl.env diff --git a/security/nss/tests/smime/interop-openssl/fran-oaep-sha512hash_ossl.env b/security/nss/tests/smime/interop-openssl/fran-oaep-sha512hash_ossl.env Binary files differnew file mode 100644 index 0000000000..32120cf797 --- /dev/null +++ b/security/nss/tests/smime/interop-openssl/fran-oaep-sha512hash_ossl.env diff --git a/security/nss/tests/smime/interop-openssl/fran-oaep-sha512mgf_ossl.env b/security/nss/tests/smime/interop-openssl/fran-oaep-sha512mgf_ossl.env Binary files differnew file mode 100644 index 0000000000..ebc42c2249 --- /dev/null +++ b/security/nss/tests/smime/interop-openssl/fran-oaep-sha512mgf_ossl.env diff --git a/security/nss/tests/smime/interop-openssl/fran-oaep_ossl-sha256hash-sha256mgf-label.env b/security/nss/tests/smime/interop-openssl/fran-oaep_ossl-sha256hash-sha256mgf-label.env Binary files differnew file mode 100644 index 0000000000..03f219c59d --- /dev/null +++ b/security/nss/tests/smime/interop-openssl/fran-oaep_ossl-sha256hash-sha256mgf-label.env diff --git a/security/nss/tests/smime/interop-openssl/fran-oaep_ossl.env b/security/nss/tests/smime/interop-openssl/fran-oaep_ossl.env Binary files differnew file mode 100644 index 0000000000..87a1237407 --- /dev/null +++ b/security/nss/tests/smime/interop-openssl/fran-oaep_ossl.env diff --git a/security/nss/tests/smime/smime.sh b/security/nss/tests/smime/smime.sh index 4cee298182..940d7ad0fa 100755 --- a/security/nss/tests/smime/smime.sh +++ b/security/nss/tests/smime/smime.sh @@ -76,6 +76,8 @@ smime_init() cp ${QADIR}/smime/alice.txt ${SMIMEDIR} mkdir tb + cp ${QADIR}/smime/interop-openssl/*.p12 ${SMIMEDIR}/tb + cp ${QADIR}/smime/interop-openssl/*.env ${SMIMEDIR} make_multipart "------------ms030903020902020502030404" multipart_start="$mp_start" @@ -481,6 +483,134 @@ smime_p7() done } +smime_enveloped_openssl_interop() { + echo "$SCRIPTNAME: OpenSSL interoperability --------------------------------" + + ${BINDIR}/pk12util -d ${P_R_ALICEDIR} -i tb/Fran.p12 -W nss -K nss + ${BINDIR}/pk12util -d ${P_R_ALICEDIR} -i tb/Fran-ec.p12 -W nss -K nss + + echo "This is a test message to Fran." > fran.txt + + echo "cmsutil -D -i fran-oaep_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data1" + ${PROFTOOL} ${BINDIR}/cmsutil -D -i fran-oaep_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data1 + html_msg $? 0 "Decode OpenSSL OAEP Enveloped Data Fran" "." + + diff fran.txt fran-oaep.data1 + html_msg $? 0 "Compare Decoded with OpenSSL enveloped" "." + + echo "cmsutil -D -i fran-oaep-sha256hash_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data2" + ${PROFTOOL} ${BINDIR}/cmsutil -D -i fran-oaep-sha256hash_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data2 + html_msg $? 0 "Decode OpenSSL OAEP Enveloped Data Fran" "." + + diff fran.txt fran-oaep.data2 + html_msg $? 0 "Compare Decoded with OpenSSL enveloped" "." + + echo "cmsutil -D -i fran-oaep-sha384hash_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data3" + ${PROFTOOL} ${BINDIR}/cmsutil -D -i fran-oaep-sha384hash_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data3 + html_msg $? 0 "Decode OpenSSL OAEP Enveloped Data Fran" "." + + diff fran.txt fran-oaep.data3 + html_msg $? 0 "Compare Decoded with OpenSSL enveloped" "." + + echo "cmsutil -D -i fran-oaep-sha512hash_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data4" + ${PROFTOOL} ${BINDIR}/cmsutil -D -i fran-oaep-sha512hash_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data4 + html_msg $? 0 "Decode OpenSSL OAEP Enveloped Data Fran" "." + + diff fran.txt fran-oaep.data4 + html_msg $? 0 "Compare Decoded with OpenSSL enveloped" "." + + echo "cmsutil -D -i fran-oaep-sha256mgf_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data5" + ${PROFTOOL} ${BINDIR}/cmsutil -D -i fran-oaep-sha256mgf_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data5 + html_msg $? 0 "Decode OpenSSL OAEP Enveloped Data Fran" "." + + diff fran.txt fran-oaep.data5 + html_msg $? 0 "Compare Decoded with OpenSSL enveloped" "." + + echo "cmsutil -D -i fran-oaep-sha384mgf_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data6" + ${PROFTOOL} ${BINDIR}/cmsutil -D -i fran-oaep-sha384mgf_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data6 + html_msg $? 0 "Decode OpenSSL OAEP Enveloped Data Fran" "." + + diff fran.txt fran-oaep.data6 + html_msg $? 0 "Compare Decoded with OpenSSL enveloped" "." + + echo "cmsutil -D -i fran-oaep-sha512mgf_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data7" + ${PROFTOOL} ${BINDIR}/cmsutil -D -i fran-oaep-sha512mgf_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data7 + html_msg $? 0 "Decode OpenSSL OAEP Enveloped Data Fran" "." + + diff fran.txt fran-oaep.data7 + html_msg $? 0 "Compare Decoded with OpenSSL enveloped" "." + + echo "cmsutil -D -i fran-oaep-label_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data8" + ${PROFTOOL} ${BINDIR}/cmsutil -D -i fran-oaep-label_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data8 + html_msg $? 0 "Decode OpenSSL OAEP Enveloped Data Fran" "." + + diff fran.txt fran-oaep.data8 + html_msg $? 0 "Compare Decoded with OpenSSL enveloped" "." + + echo "cmsutil -D -i fran-oaep-sha256hash-sha256mgf_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data9" + ${PROFTOOL} ${BINDIR}/cmsutil -D -i fran-oaep-sha256hash-sha256mgf_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data9 + html_msg $? 0 "Decode OpenSSL OAEP Enveloped Data Fran" "." + + diff fran.txt fran-oaep.data9 + html_msg $? 0 "Compare Decoded with OpenSSL enveloped" "." + + echo "cmsutil -D -i fran-oaep-sha256hash-label_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data10" + ${PROFTOOL} ${BINDIR}/cmsutil -D -i fran-oaep-sha256hash-label_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data10 + html_msg $? 0 "Decode OpenSSL OAEP Enveloped Data Fran" "." + + diff fran.txt fran-oaep.data10 + html_msg $? 0 "Compare Decoded with OpenSSL enveloped" "." + + echo "cmsutil -D -i fran-oaep-sha256mgf-label_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data11" + ${PROFTOOL} ${BINDIR}/cmsutil -D -i fran-oaep-sha256mgf-label_ossl.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data11 + html_msg $? 0 "Decode OpenSSL OAEP Enveloped Data Fran" "." + + diff fran.txt fran-oaep.data11 + html_msg $? 0 "Compare Decoded with OpenSSL enveloped" "." + + echo "cmsutil -D -i fran-oaep_ossl-sha256hash-sha256mgf-label.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data12" + ${PROFTOOL} ${BINDIR}/cmsutil -D -i fran-oaep_ossl-sha256hash-sha256mgf-label.env -d ${P_R_ALICEDIR} -p nss -o fran-oaep.data12 + html_msg $? 0 "Decode OpenSSL OAEP Enveloped Data Fran" "." + + diff fran.txt fran-oaep.data12 + html_msg $? 0 "Compare Decoded with OpenSSL enveloped" "." + + echo "cmsutil -D -i fran-ec_ossl-aes128-sha1.env -d ${P_R_ALICEDIR} -p nss -o fran.data1" + ${PROFTOOL} ${BINDIR}/cmsutil -D -i fran-ec_ossl-aes128-sha1.env -d ${P_R_ALICEDIR} -p nss -o fran.data1 + html_msg $? 0 "Decode OpenSSL Enveloped Data Fran (ECDH, AES128 key wrap, SHA-1 KDF)" "." + + diff fran.txt fran.data1 + html_msg $? 0 "Compare Decoded with OpenSSL enveloped" "." + + echo "cmsutil -D -i fran-ec_ossl-aes128-sha224.env -d ${P_R_ALICEDIR} -p nss -o fran.data2" + ${PROFTOOL} ${BINDIR}/cmsutil -D -i fran-ec_ossl-aes128-sha224.env -d ${P_R_ALICEDIR} -p nss -o fran.data2 + html_msg $? 0 "Decode OpenSSL Enveloped Data Fran (ECDH, AES128 key wrap, SHA-224 KDF)" "." + + diff fran.txt fran.data2 + html_msg $? 0 "Compare Decoded with OpenSSL enveloped" "." + + echo "cmsutil -D -i fran-ec_ossl-aes128-sha256.env -d ${P_R_ALICEDIR} -p nss -o fran.data3" + ${PROFTOOL} ${BINDIR}/cmsutil -D -i fran-ec_ossl-aes128-sha256.env -d ${P_R_ALICEDIR} -p nss -o fran.data3 + html_msg $? 0 "Decode OpenSSL Enveloped Data Fran (ECDH, AES128 key wrap, SHA-256 KDF)" "." + + diff fran.txt fran.data3 + html_msg $? 0 "Compare Decoded with OpenSSL enveloped" "." + + echo "cmsutil -D -i fran-ec_ossl-aes192-sha384.env -d ${P_R_ALICEDIR} -p nss -o fran.data4" + ${PROFTOOL} ${BINDIR}/cmsutil -D -i fran-ec_ossl-aes192-sha384.env -d ${P_R_ALICEDIR} -p nss -o fran.data4 + html_msg $? 0 "Decode OpenSSL Enveloped Data Fran (ECDH, AES192 key wrap, SHA-384 KDF)" "." + + diff fran.txt fran.data4 + html_msg $? 0 "Compare Decoded with OpenSSL enveloped" "." + + echo "cmsutil -D -i fran-ec_ossl-aes256-sha512.env -d ${P_R_ALICEDIR} -p nss -o fran.data5" + ${PROFTOOL} ${BINDIR}/cmsutil -D -i fran-ec_ossl-aes256-sha512.env -d ${P_R_ALICEDIR} -p nss -o fran.data5 + html_msg $? 0 "Decode OpenSSL Enveloped Data Fran (ECDH, AES256 key wrap, SHA-512 KDF)" "." + + diff fran.txt fran.data5 + html_msg $? 0 "Compare Decoded with OpenSSL enveloped" "." +} + ############################## smime_main ############################## # local shell function to test basic signed and enveloped messages # from 1 --> 2" @@ -525,12 +655,26 @@ smime_main() diff alice.txt alice.data1 html_msg $? 0 "Compare Decoded Enveloped Data and Original" "." + echo "$SCRIPTNAME: Enveloped Data Tests (ECDH) ------------------------------" + echo "cmsutil -E -r bob-ec@example.com -i alice.txt -d ${P_R_ALICEDIR} -p nss \\" + echo " -o alice-ec.env" + ${PROFTOOL} ${BINDIR}/cmsutil -E -r bob-ec@example.com -i alice.txt -d ${P_R_ALICEDIR} -p nss -o alice-ec.env + html_msg $? 0 "Create Enveloped Data with Alice (ECDH)" "." + + echo "cmsutil -D -i alice-ec.env -d ${P_R_BOBDIR} -p nss -o alice.data1" + ${PROFTOOL} ${BINDIR}/cmsutil -D -i alice-ec.env -d ${P_R_BOBDIR} -p nss -o alice-ec.data1 + html_msg $? 0 "Decode Enveloped Data Alice (ECDH)" "." + + echo "diff alice.txt alice-ec.data1" + diff alice.txt alice-ec.data1 + html_msg $? 0 "Compare Decoded Enveloped Data and Original (ECDH)" "." + # multiple recip echo "$SCRIPTNAME: Testing multiple recipients ------------------------------" echo "cmsutil -E -i alice.txt -d ${P_R_ALICEDIR} -o alicecc.env \\" echo " -r bob@example.com,dave@example.com" ${PROFTOOL} ${BINDIR}/cmsutil -E -i alice.txt -d ${P_R_ALICEDIR} -o alicecc.env \ - -r bob@example.com,dave@example.com + -r bob@example.com,dave-ec@example.com ret=$? html_msg $ret 0 "Create Multiple Recipients Enveloped Data Alice" "." if [ $ret != 0 ] ; then @@ -554,7 +698,7 @@ smime_main() echo "cmsutil -D -i alicecc.env -d ${P_R_DAVEDIR} -p nss -o alice.data3" ${PROFTOOL} ${BINDIR}/cmsutil -D -i alicecc.env -d ${P_R_DAVEDIR} -p nss -o alice.data3 - html_msg $? 0 "Decode Multiple Recipients Enveloped Data Alice by Dave" "." + html_msg $? 0 "Decode Multiple Recipients Enveloped Data Alice by Dave (ECDH)" "." echo "cmsutil -D -i aliceve.env -d ${P_R_EVEDIR} -p nss -o alice.data4" ${PROFTOOL} ${BINDIR}/cmsutil -D -i aliceve.env -d ${P_R_EVEDIR} -p nss -o alice.data4 @@ -569,6 +713,8 @@ smime_main() diff alice.txt alice.data4 html_msg $? 0 "Compare Decoded with Multiple Email cert" "." + smime_enveloped_openssl_interop + echo "$SCRIPTNAME: Sending CERTS-ONLY Message ------------------------------" echo "cmsutil -O -r \"Alice,bob@example.com,dave@example.com\" \\" echo " -d ${P_R_ALICEDIR} > co.der" |