现在的位置: 首页 > 综合 > 正文

openssl rsautl RSA实用工具

2013年06月08日 ⁄ 综合 ⁄ 共 1063字 ⁄ 字号 评论关闭

<openssl rsautl> <fym0121@163.com>

介绍

openssl rsautl 使用RSA算法签名,验证,加密,解密数据。

语法

openssl rsautl[-in file] [-out file] [-inkey file] [-pubin] [-certin] [-sign] [-verify] [-encrypt] [-decrypt]
[-pkcs] [-ssl] [-raw] [-hexdump] [-asn1parse]

-inkey file / -pubin     指定密钥文件,默认是私钥;如果指定-pubin,则表示是公钥。

-sign / -verify               签名和验证(a.txx文本文件的内容是“hello world”)

E:\OpenSSL\foo>openssl rsautl -sign -in a.txt -inkey rsa_pri_nopw.pem -out a.sig   #签名
n
Loading 'screen' into random state - done

E:\OpenSSL\foo>openssl rsautl -verify -in a.sign -inkey rsa_pri_nopw.pem      #私钥验证
Loading 'screen' into random state - done
hello world

E:\OpenSSL\foo>openssl rsautl -verify -in a.sign -pubin -inkey rsa_pub_nopw.pem   #公钥验证
Loading 'screen' into random state - done
hello world

E:\OpenSSL\foo>openssl rsautl -verify -in a.sign -inkey demoCA\cacert.pem -certin   #证书验证
Loading 'screen' into random state - done
hello world

-encrypt / -decrypt      加解密

E:\OpenSSL\foo>openssl rsautl -encrypt -in a.txt -pubin  -inkey rsa_pub_nopw.pem -out a.enc
Loading 'screen' into random state - done

E:\OpenSSL\foo>openssl rsautl -decrypt -in a.enc -inkey rsa_pri_nopw.pem
Loading 'screen' into random state - done
hello world

关于证书请参见<openssl req>

抱歉!评论已关闭.