mirror of
https://gitlab.kit.edu/kit/scc/sys/mail/exim-encrypt-dlfunc.git
synced 2025-12-06 07:23:56 +01:00
Fixed test numbering
This commit is contained in:
@ -1,30 +1,45 @@
|
||||
#!/bin/bash
|
||||
# shellcheck disable=SC2034
|
||||
|
||||
set -e
|
||||
|
||||
PATH=/sbin:/usr/sbin:$PATH
|
||||
|
||||
# this script implements the TAP protocol (https://testanything.org)
|
||||
echo 1..4
|
||||
|
||||
TEST_PASSWORD='ThisIsAPassword'
|
||||
TEST_CLEARTEXT='This is my cleartext'
|
||||
TEST_CIPHERTEXT01='RCHI+VukmWIsVE3eixbWIAtPPBW63nmV1ITpSBEDYXC9Y5QMBd1zmGLLhE+S9yg0sHfOF/1+wmfF7YXv'
|
||||
TEST_CIPHERTEXT02='sEG09WnEKIN2nyJYGNNVo14o7wV6X9HQxW+zxAxMLX9jVdashdaoHqLXQGM8lzpJhG6629lccjzAfrq8'
|
||||
CIPHERTEXT_FILE01="$(mktemp)"
|
||||
CIPHERTEXT_FILE02="$(mktemp)"
|
||||
echo "${TEST_CIPHERTEXT01}" > "${CIPHERTEXT_FILE01}"
|
||||
echo "${TEST_CIPHERTEXT02}" > "${CIPHERTEXT_FILE02}"
|
||||
|
||||
DECRYPTED01="$(LIBEXIM_PASSWORD="${TEST_PASSWORD}" src/libexim-encrypt-dlfunc-decrypt-secretbox ${TEST_CIPHERTEXT01})"
|
||||
|
||||
if [ "${DECRYPTED01}" == "${TEST_CLEARTEXT}" ] ; then
|
||||
echo "decryption with password from environment successful"
|
||||
echo "ok 1 - decrypt commandline argument with password from environment successful"
|
||||
else
|
||||
echo "decryption with password from environment unsuccessful"
|
||||
exit 127
|
||||
echo "not ok 1 - decrypt commandline argument with password from environment unsuccessful"
|
||||
fi
|
||||
|
||||
unset LIBEXIM_PASSWORD
|
||||
DECRYPTED02="$(src/libexim-encrypt-dlfunc-decrypt-secretbox -p ${TEST_PASSWORD} ${TEST_CIPHERTEXT02})"
|
||||
|
||||
DECRYPTED02="$(LIBEXIM_PASSWORD="${TEST_PASSWORD}" src/libexim-encrypt-dlfunc-decrypt-secretbox --infile ${CIPHERTEXT_FILE01})"
|
||||
if [ "${DECRYPTED02}" == "${TEST_CLEARTEXT}" ] ; then
|
||||
echo "decryption with password from commandline successful"
|
||||
echo "ok 2 - decrypt file contents with password from environment successful"
|
||||
else
|
||||
echo "decryption with password from commandline unsuccessful"
|
||||
exit 128
|
||||
echo "not ok 2 - decrypt file contents with password from environment unsuccessful"
|
||||
fi
|
||||
unset LIBEXIM_PASSWORD
|
||||
|
||||
DECRYPTED03="$(src/libexim-encrypt-dlfunc-decrypt-secretbox -p ${TEST_PASSWORD} ${TEST_CIPHERTEXT02})"
|
||||
if [ "${DECRYPTED03}" == "${TEST_CLEARTEXT}" ] ; then
|
||||
echo "ok 3 - decrypt commandline argument with password from commandline successful"
|
||||
else
|
||||
echo "not ok 3 - decrypt commandline argument with password from commandline unsuccessful"
|
||||
fi
|
||||
|
||||
DECRYPTED04="$(src/libexim-encrypt-dlfunc-decrypt-secretbox -p ${TEST_PASSWORD} --infile ${CIPHERTEXT_FILE02})"
|
||||
if [ "${DECRYPTED04}" == "${TEST_CLEARTEXT}" ] ; then
|
||||
echo "ok 4 - decrypt commandline argument with password from commandline successful"
|
||||
else
|
||||
echo "not ok 4 - decrypt commandline argument with password from commandline unsuccessful"
|
||||
fi
|
||||
Reference in New Issue
Block a user