I am trying to generate and verify the signature with a private key. Its a very straight forward process. However, I am facing this issue.
clear
Echo "Generate EC KeyPair from OpenSSL command line"
Echo "1. Create the EC key:"
openssl ecparam -genkey -name prime192v1 > key.pem
Echo "`n2.Set it to ANSI Encoding now"
cmd /c pause
Echo "`n3. Extract the public key:"
openssl ec -in key.pem -pubout > pub.pem
cmd /c pause
Echo "`n4. Calculate the hash:"
openssl dgst -sha256 -binary random.bin > hash.txt
cmd /c pause
Echo "`n5. Sign the hash with the private key:"
openssl pkeyutl -sign -inkey key.pem -in hash.txt > sig.txt
cmd /c pause
Echo "`n6. Verify the signature with the public key:"
openssl pkeyutl -verify -in hash.txt -sigfile sig.txt -inkey key.pem
Echo "`n"type here
I expect the signature verification to be successful, as I have made no changes whatsoever.
Here is my dummy data attached. I have tried with multiple size but I face the same error. Any insight would be greatly appreciated. Thank you enter image description here
OpenSSL 1.1.1k 25 Mar 2021