First, Introduction
RSAUTL instruction can use RSA algorithm signature, verify identity, encrypt/decrypt data
Second, the grammar
OpenSSL rsautl [-infilefile] [-passin arg] [-keyform pem| Der|net] [-pubin] [-certin][-asn1parse] [-hexdump] [-raw] [-OAEP] [-SSL] [-PKCS] [-x931] [-sign] [-verify][- Encrypt] [-decrypt] [-rev] [-engine E]
Options
-inch fileInputfile-outfileOutputfile-inkeyfileinput Key-keyform ARG private key format-default PEM-Pubin input is a RSA public-certin input is a certificate carrying an RSA public key-SSL Use SSL v2 padding-raw use no padding-PKCS Use pkcs#1V1.5padding (default)-OAEP Use pkcs#1OAEP-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
Third, examples
1. Signature Verification
OpenSSL Rsautl-sign-inkey Prikey.pem-passin pass:123456 - in Test.txt-outTest_sign.msgopenssl R Sautl-verify-inkey pubkey.pem-pubin-passin pass:123456-in test_sign.msg
2. Encrypt and decrypt
OpenSSL rsautl-encrypt-pubin-inkey Pubkey.pem- in Test.txt--decrypt-inkey prikey.pem-passin pass:< c5>123456 - in Test_cipher.txt
Reference: http://blog.csdn.net/as3luyuan123/article/details/16812011
Openssl rsautl Command