diff --git a/tests/scripts/asym_cipher.sh b/tests/scripts/asym_cipher.sh index c75bf20..2e50d6e 100755 --- a/tests/scripts/asym_cipher.sh +++ b/tests/scripts/asym_cipher.sh @@ -7,9 +7,9 @@ test $? -eq 0 || exit $? rsa_encrypt_decrypt() { openssl pkeyutl -encrypt -pubin -inkey 1.pub $2 -in $1 -out data.crypt test $? -eq 0 && echo -n "." || exit $? - TDATA=$(tr -d '\0' < <(pkcs11-tool --id 1 --pin 648219 --decrypt $3 -i data.crypt 2>/dev/null)) + TDATA=$(pkcs11-tool --id 1 --pin 648219 --decrypt $3 -i data.crypt 2>/dev/null | sed '/^OAEP parameters:/d' | tr -d '\0') test $? -eq 0 && echo -n "." || exit $? - if [[ ${TEST_STRING} != "$TDATA" ]]; then + if [[ "$TEST_STRING" != "$TDATA" ]]; then exit 1 fi test $? -eq 0 && echo -n "." || exit $? @@ -36,7 +36,7 @@ rsa_encrypt_decrypt data_pad "-pkeyopt rsa_padding_mode:none" "--mechanism RSA-X test $? -eq 0 && echo -e ".\t${OK}" || exit $? echo -n " Test RSA-PKCS-OAEP ciphering..." -rsa_encrypt_decrypt data "-pkeyopt rsa_padding_mode:oaep -pkeyopt rsa_oaep_md:sha256 -pkeyopt rsa_mgf1_md:sha256" "--mechanism RSA-PKCS-OAEP" +rsa_encrypt_decrypt data "-pkeyopt rsa_padding_mode:oaep -pkeyopt rsa_oaep_md:sha256 -pkeyopt rsa_mgf1_md:sha256" "--mechanism RSA-PKCS-OAEP --hash-algorithm SHA256 --mgf MGF1-SHA256" test $? -eq 0 && echo -e ".\t${OK}" || exit $? rm -rf data* 1.*