cryptoget.sh 889 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/bash
  2. SCRIPT_PATH=${0%/*}
  3. if [ "$0" != "$SCRIPT_PATH" ] && [ "$SCRIPT_PATH" != "" ]; then
  4. cd "$SCRIPT_PATH/.."
  5. fi
  6. DAEMONFILEPATH="../../daemon/build/files"
  7. if [ $# -eq 1 ];
  8. then DAEMONFILEPATH="$1"
  9. fi
  10. echo "am in directory $PWD"
  11. echo "using file path $DAEMONFILEPATH"
  12. test/cryptotest_gcm 1 test/samplekey1.bin test/samplefile.txt $DAEMONFILEPATH/samplefile.txt
  13. ./ccats-cli --batch test/cryptoget.txt
  14. if [ ! -f test/cryptoput.txt.out ];
  15. then
  16. echo "running of batch file failed"
  17. exit 1;
  18. fi
  19. if [ ! -f samplefile.txt ];
  20. then
  21. echo "file didnt download"
  22. echo "STDOUT is :"
  23. cat test/cryptoput.txt.out
  24. echo "STDERR is :"
  25. cat test/cryptoput.txt.err
  26. exit 1;
  27. fi
  28. diff samplefile.txt test/samplefile.txt
  29. DIFFRES=$?
  30. rm $DAEMONFILEPATH/samplefile.txt
  31. rm samplefile.txt
  32. if [ $DIFFRES -ne 0 ];
  33. then
  34. echo "files are not equal after decryption: $DIFFRES"
  35. exit 1;
  36. fi
  37. exit 0;