一、简介
pkey是一个公钥或私钥的处理命令,可以用于打印和转换不同的表单和组件
二、语法
openssl pkey [-inform PEM|DER] [-outform PE|DER] [-in filename] [-passin arg] [-out filename] [-passout arg] [-cipher] [-text] [-text_pub] [-noout] [-pubin] [-pubout] [-engine id]
选项
-in file input file-inform X input format (DER or PEM)-passin arg input file pass phrase source-outform X output format (DER or PEM)-out file output file-passout arg output file pass phrase source-engine e use engine e, possibly a hardware device.
三、实例
1、去除RSA密钥的输入口令
openssl pkey -in prikey.pem -out keyout.pem
2、加密私钥
openssl pkey –in prikey.pem -des3 -out keyout.pem
3、PEM格式私钥转换为DER格式私钥
openssl pkey –in prikey.pem -outform DER –out prikey.der
4、从私钥提取公钥
openssl pkey –in prikey.pem -pubout -out pubkey.pem
参考: