码迷,mamicode.com
首页 > 其他好文 > 详细

Openssl rsautl命令

时间:2015-07-25 12:03:37      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:

一、简介

rsautl指令能够使用RSA算法签名,验证身份,加密/解密数据

 

二、语法

openssl rsautl [-in file] [-out file] [-inkey file] [-passin arg] [-keyform PEM|DER|NET] [-pubin] [-certin]
[-asn1parse] [-hexdump] [-raw] [-oaep] [-ssl] [-pkcs] [-x931] [-sign] [-verify][-encrypt] [-decrypt] [-rev] 
[-engine e]

选项

-in file        input file
-out file       output file
-inkey file     input key
-keyform arg    private key format - default PEM
-pubin          input is an RSA public
-certin         input is a certificate carrying an RSA public key
-ssl            use SSL v2 padding
-raw            use no padding
-pkcs           use PKCS#1 v1.5 padding (default)
-oaep           use PKCS#1 OAEP
-sign           sign with private key
-verify         verify with public key
-encrypt        encrypt with public key
-decrypt        decrypt with private key
-hexdump        hex dump output
-engine e       use engine e, possibly a hardware device.
-passin arg    pass phrase source

 

三、实例

1、签名验签

openssl rsautl -sign -inkey prikey.pem -passin pass:123456 -in test.txt -out test_sign.msg
openssl rsautl -verify -inkey pubkey.pem -pubin -passin pass:123456 -in test_sign.msg

技术分享

2、加密解密

openssl rsautl -encrypt -pubin -inkey pubkey.pem -in test.txt -out test_cipher.txt
openssl rsautl -decrypt -inkey prikey.pem -passin pass:123456 -in test_cipher.txt
技术分享

 

Openssl rsautl命令

标签:

原文地址:http://www.cnblogs.com/274914765qq/p/4675535.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!