I would like to sign and verify a pdf with elliptic curve. I got some code but it dosen'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 dosen't work.
test.pdf
could be interpreted as if it had any other extension, e.g..txt
. This means that the signature will be calculated over the entire raw file and it won't produce a native PDF signature, i.e. the type of signature that can be interpreted by Adobe Acrobat.