1

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

asked Apr 12, 2023 at 14:51
1
  • I just ran the openssl commands in your code on Arch Linux with OpenSSL 3.4.0 22 Oct 2024 (Library: OpenSSL 3.4.0 22 Oct 2024). Creating the signature worked and signature verification was successful as well. Can you still reproduce the error? Commented Nov 7, 2024 at 0:12

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.