Openssl pkeyutl命令

weixin_34198583發表於2015-07-25

一、簡介

pkeyutl命令能夠測試所支援的金鑰演算法的效能

 

二、語法

openssl rsautl [-in file] [-out file] [-sigfile file] [-inkey file] [-passin arg] [-keyform PEM|DER] [-peerkey file] 
[-peerform PEM|DER] [-pubin] [-certin] [-rev] [-sign] [-verify] [-verifyrecover ] [-encrypt] [-decrypt] [-derive]
[-pkeyopt opt:value] [-asn1parse] [-engine e]

選項

-in file        input file
-out file       output file
-sigfile file signature file (verify operation only)
-inkey file     input key
-keyform arg    private key format - default PEM
-pubin          input is a public key
-certin         input is a certificate carrying a public key
-pkeyopt X:Y    public key options
-sign           sign with private key
-verify         verify with public key
-verifyrecover  verify with public key, recover original data
-encrypt        encrypt with public key
-decrypt        decrypt with private key
-derive         derive shared secret
-hexdump        hex dump output
-engine e       use engine e, possibly a hardware device.
-passin arg     pass phrase source

 

三、例項

1、簽名驗籤

openssl pkeyutl -sign -inkey prikey.pem -in test.txt -out test_sign.msg
openssl pkeyutl -verify -in test.txt -sigfile test_sign.msg -inkey prikey.pem

image

2、恢復簽名資料

openssl pkeyutl -verifyrecover -in test_sign.msg -inkey prikey.pem

image

 

相關文章