标签:
一、简介
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
标签:
原文地址:http://www.cnblogs.com/274914765qq/p/4675535.html