3

I would like to sign and verify a pdf with elliptic curve. I got some code but it doesn't work.

Create private key:

openssl ecparam -genkey -name secp384r1 -noout -out private.pem

Create public key:

openssl ec -in private.pem -pubout -out public.pem

Sign file:

openssl dgst -ecdsa-with-SHA1 test.pdf > hash openssl dgst
openssl dgst -ecdsa-with-SHA1 -inkey private.pem -keyform PEM -in hash > signature

Verify file:

openssl dgst -ecdsa-with-SHA1 -verify public.pem -signature signature.bin data

The part to sign and verify doesn't work.

divanov
  • 6,173
  • 3
  • 32
  • 51
Michael
  • 113
  • 1
  • 1
  • 8
  • This question appears to be off-topic because it was asked/answered on SuperUser - http://superuser.com/questions/737574/openssl-ecdsa-sign-and-verify-file – Taryn Jul 23 '14 at 16:35

1 Answers1

7

I'm not sure where you're getting these command line options from - the help for dgst doesn't indicate that -ecdsa-with-SHA1, -inkey or -in are valid options. Try:

Sign:

openssl dgst -sha1 -sign private.pem < test.pdf > signature.bin

Verify:

openssl dgst -sha1 -verify public.pem -signature signature.bin < test.pdf
Iridium
  • 23,323
  • 6
  • 52
  • 74