OpenSSL 数字签名
示例
# 1. Create private/public key pair
openssl genrsa -out private.key 1024
# 2. Extracting Public key
openssl rsa -in private.key -out public.pem -outform PEM -pubout
# 3. Create hash of the data.
echo 'data to sign' > example.txt
openssl dgst -sha256 < example.txt > hash
# 4. Sign the hash using Private key to a file called hash.sign
openssl dgst -sha256 -sign private.key -out hash.sign hash
# 5. Verify the file (example.txt)and the digital signature (hash.sign)
openssl dgst -sha256 -verify public.pem -signature hash.sign hash