The following command generates a signature for an input file:
openssl dgst -sha1 -sign privateKey.pem -out signature1 someInputFile
The following commands also generates a signature for an input file:
openssl dgst -binary -sha1 someInputFile > digest
openssl rsautl -sign -in digest -inkey privateKey.pem -out signature2
As far as I know, they should both create the RSA signature of a SHA1 digest of the file. But they don't generate the same signature.
As a result, the signature generated with method 2 can also not be verified by an openssl dgst -verify
call.
Does somebody know what the difference is, and how that can be overcome?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…