Computing the signature of hello.txt file which has the text hello
in it, here is done in two steps:
openssl sha1 -binary -out hash hello.txt
openssl pkeyutl -sign -inkey private.key -in hash -out signed -pkeyopt digest:sha1
First we'll get the digest value in the hash file, then this file is signed getting the signed file, this file is the signature of hello.txt
But, when i try to encrypt this hash file;
openssl pkeyutl -encrypt -inkey private.key -in hash -out encrypted
The file encrypted is different from signed. Why these two files are differents? if the answer to my question is no, why not?