生成一个1024位的密钥
openssl genrsa -out test.key 1024
从密钥文件里分离出公钥
openssl rsa -in test.key -pubout -out test_pub.key
使用公钥对文件进行加密
openssl rsautl -encrypt -in hello.txt -inkey test_pub.key -pubin -out hello.en
其中-pubin表示只用公钥加密
使用密钥对文件进行解密
openssl rsautl -decrypt -in hello.ec -inkey test.key -out hello.de
本文介绍了如何使用OpenSSL工具生成1024位的RSA密钥对,并演示了利用该密钥对文件进行加密与解密的具体步骤。

2488

被折叠的 条评论
为什么被折叠?



