Skip to content

Instantly share code, notes, and snippets.

@Roadmaster
Created July 30, 2020 21:45
Show Gist options
  • Save Roadmaster/ed8344c7c801457fa3b27eb81e0c5ce4 to your computer and use it in GitHub Desktop.
Save Roadmaster/ed8344c7c801457fa3b27eb81e0c5ce4 to your computer and use it in GitHub Desktop.
def roadmr_mini_openssl_dgst():
print("HELLO")
print("let's try to reimplement openssl")
#openssl dgst -sha1 -verify sample-public-key.pub -signature /tmp/signature /tmp/data
pubkeyfile = "keys/sample/sample-public-key.pub"
signaturefile = "keys/sample/signature"
datafile = "keys/sample/data"
pubkey = M2Crypto.EVP.load_key_string_pubkey(
open("keys/sample/sample-public-key.pub", "rb").read())
pubkey.verify_init()
pubkey.verify_update(open(datafile, "rb").read())
result = pubkey.verify_final(open(signaturefile, "rb").read())
print(result)
print("I'm maybe done (1 succ, 0 fail, -1 err)")
raise SystemExit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment