Closed msramalho closed 4 months ago
asked an LLM to convert the bash code into python, though it's still very bashy:
import subprocess
# Step 1: Create a tsq file (SHA 512)
subprocess.run(["openssl", "ts", "-query", "-data", "file.png", "-no_nonce", "-sha512", "-out", "file.tsq"])
# Step 2: cURL Time Stamp Request Input (HTTP / HTTPS)
curl_command = [
"curl",
"-H", "Content-Type: application/timestamp-query",
"--data-binary", "@file.tsq",
"https://freetsa.org/tsr"
]
with open("file.tsr", "wb") as tsr_file:
subprocess.run(curl_command, stdout=tsr_file)
# Step 3: Verify tsr file
subprocess.run(["wget", "https://freetsa.org/files/tsa.crt"])
subprocess.run(["wget", "https://freetsa.org/files/cacert.pem"])
# Timestamp Information
subprocess.run(["openssl", "ts", "-reply", "-in", "file.tsr", "-text"])
# Verify (two different ways)
verify_command = [
"openssl", "ts", "-verify",
"-in", "file.tsr",
"-queryfile", "file.tsq",
"-CAfile", "cacert.pem",
"-untrusted", "tsa.crt"
]
subprocess.run(verify_command)
in a way this is connected to #90
other RFC3161 servers listed here: https://gist.github.com/Manouchehri/fd754e402d98430243455713efada710
Following information from this timestamp-authority repo ( RFC3161 Timestamp Authority) implement a Step which connects to a timestamp authority server, one example that can be tested write away is https://freetsa.org/index_en.php
taken from there a full example with sha512 is:
Discussion topics
Given the cyclical definition of this, I wonder what is the best way to implement it as it needs to run after the HtmlFormatter which can only happen as a database meaning the formatter should only include/display the links if they actually exist.