前言
附上openssl的文档:openssl文档
一、编程要求
-
创建一个内容为 GuetPython的明文文件hello.txt
-
使用genrsa产生1024bit的明文rsa私钥privacy.pem,即没有加密过的私钥
-
使用rsa输出公钥文件public.pem
-
使用公钥文件public.pem加密hello.txt为hello.en
-
使用私钥privacy.pem解密hello.en为hello.de
-
测试文件会使用cat命令输出hello.de的内容检查是否正确解密
2.代码
代码如下:
echo GuetPython >hello.txt
openssl genrsa -out privacy.pem 1024
openssl rsa -in privacy.pem -pubout -out public.pem
openssl rsautl -encrypt -pubin -inkey public.pem -in hello.txt -out hello.en
openssl rsautl -decrypt -inkey privacy.pem -in hello.en -out hello.de
本文介绍了如何使用OpenSSL工具生成1024位的RSA密钥对(privacy.pem和public.pem),并通过加密hello.txt文件(hello.en)和解密过程(hello.de),验证加密解密功能。文章提供了一个编程示例并鼓励读者指出可能存在的错误。
2932

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



