Created
July 30, 2020 21:45
-
-
Save Roadmaster/ed8344c7c801457fa3b27eb81e0c5ce4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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