# The message to Timestamp
MESG="Frederik Jack is a bubbly Border Collie"
# Filename for Timestamp Request (/tmp/${FILE}.tsq) and Response (/tmp/${FILE}.tsr)
FILE="file"
# Create a Timestamp Request, persist it, submit it to FreeTSA and persist the Response
go run github.com/DazWilkin/FreeTSA \
--mesg=${MESG} \
--file=${FILE}
# Download the FreeTSA certs to /tmp
wget --output-document=/tmp/tsa.crt https://freetsa.org/files/tsa.crt
wget --output-document=/tmp/cacert.pem https://freetsa.org/files/cacert.pem
# Use OpenSSL Timestamp tool to verify the Request|Response using FreeTSA's certs
openssl ts -verify \
-in /tmp/${FILE}.tsr \
-queryfile /tmp/${FILE}.tsq \
-CAfile /tmp/cacert.pem \
-untrusted /tmp/tsa.crt
# Tidy
rm /tmp/${FILE}.ts? /tmp/cacert.pem /tmp/tsa.crt