admin管理员组

文章数量:1639684

生成一个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

本文标签: 算法加密解密文件LinuxOpenSSL