OpenSSL 文件数字签名

发布时间: 更新时间: 总字数:91 阅读时间:1m 作者: IP上海 分享 网址

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

参考

  1. https://opensource.com/article/19/6/cryptography-basics-openssl-part-2
Home Archives Categories Tags Statistics
本文总阅读量 次 本站总访问量 次 本站总访客数