I read on stack overflow that OpenSSL performs ASN1 encoding to the hash before signing it for, for ECDSA.
In other words, OpenSSL performs the following steps when for an Elliptic curve key -sign
is called:
Calculate $H = Hash(M)$
Encode $H$ into ASN1 standard $H’$
Sign $H’$
If the above is true then in order to avoid applying step 1. it's necessary to first calculate the digest, and then sign the digest using raw signing -pkeyutl
for elliptic curver keys.
However when I run BOTH -sign
and -dgst
+ -pkeyutl
I am able to verify the signature using -verify
in both cases. This implies that ASN1 encoding is NOT being applied to the hash.
Can anyone throw some light on this topic? I was not able to find information in the OpenSSL documentation.