openssl rsa 命令行 用法
2017-05-07 21:39
302 查看
openssl工具的简单使用:
生成一个密钥:
openssl genrsa -out test.key 1024
这里-out指定生成文件的。需要注意的是这个文件包含了公钥和密钥两部分,也就是说这个文件即可用来加密也可以用来解密。后面的1024是生成密钥的长度。
openssl可以将这个文件中的公钥提取出来:
openssl rsa -in
test.key -pubout -out test_pub.key
-in指定输入文件,-out指定提取生成公钥的文件名。至此,我们手上就有了一个公钥,一个私钥(包含公钥)。现在可以将用公钥来加密文件了。
我在目录中创建一个hello的文本文件,然后利用此前生成的公钥加密文件:
openssl rsautl -encrypt -in
hello -inkey test_pub.key -pubin -out hello.en
-in指定要加密的文件,-inkey指定密钥,-pubin表明是用纯公钥文件加密,-out为加密后的文件。
解密文件:
openssl rsautl -decrypt -in
hello.en -inkey test.key -out hello.de
原地址:http://www.cnblogs.com/aLittleBitCool/archive/2011/09/22/2185418.html
生成一个密钥:
openssl genrsa -out test.key 1024
这里-out指定生成文件的。需要注意的是这个文件包含了公钥和密钥两部分,也就是说这个文件即可用来加密也可以用来解密。后面的1024是生成密钥的长度。
openssl可以将这个文件中的公钥提取出来:
openssl rsa -in
test.key -pubout -out test_pub.key
-in指定输入文件,-out指定提取生成公钥的文件名。至此,我们手上就有了一个公钥,一个私钥(包含公钥)。现在可以将用公钥来加密文件了。
我在目录中创建一个hello的文本文件,然后利用此前生成的公钥加密文件:
openssl rsautl -encrypt -in
hello -inkey test_pub.key -pubin -out hello.en
-in指定要加密的文件,-inkey指定密钥,-pubin表明是用纯公钥文件加密,-out为加密后的文件。
解密文件:
openssl rsautl -decrypt -in
hello.en -inkey test.key -out hello.de
原地址:http://www.cnblogs.com/aLittleBitCool/archive/2011/09/22/2185418.html
相关文章推荐
- OpenSSL的命令行用法,以及参数大全
- openssl命令行进行RSA加密解密
- openssl和keytool对rsa密钥的管理机制及用法
- openssl对rsa密钥的管理用法
- OpenSSL RSA 用法
- OpenSSL 编程 - RSA 加密解密
- 用openssl进行rsa的加密与解密(linux,C++版)
- 如何用openssl命令行生成证书
- Bash命令行历史用法【转】
- Openssl之RSA相关函数介绍
- openssl命令用法
- ml.exe编译器常用选项及命令行用法
- java/php/c#版rsa签名以及java验签实现openssl生成
- Linux之加密解密工具openssl的用法以及自建CA
- memcached命令行及其用法
- bash命令行历史用法小结
- C/C++使用openssl进行摘要和加密解密(md5, sha256, des, rsa)
- ios调支付宝找不到头文件<openssl/rsa.h>
- 如何使用openssl生成RSA公钥和私钥对
- Build openssl with just RSA and AES