pkey - public or private key processing tool
gmssl pkey [-help] [-inform PEM|DER] [-outform PEM|DER] [-in filename] [-passin arg] [-out filename] [-passout arg] [-traditional] [-cipher] [-text] [-text_pub] [-noout] [-pubin] [-pubout] [-engine id]
The pkey command processes public or private keys. They can be converted between various forms and their components printed out.
pkey指令处理公钥或者私钥。 它们可以在各种形式之间进行转换,并将其组件打印出来。
Print out a usage message.
打印使用信息。
This specifies the input format DER or PEM.
该选项指出了输入格式是DER还是PEM。
This specifies the output format, the options have the same meaning as the -inform option.
该选项指出了输出格式,与-inform意义相同。
This specifies the input filename to read a key from or standard input if this option is not specified. If the key is encrypted a pass phrase will be prompted for.
如果该选项没有被指定,则指定从密钥中读取输入文件名或者标准输入。 如果密钥被加密,将提示输入密码。
the input file password source. For more information about the format of arg see the PASS PHRASE ARGUMENTS section in -out filename
This specifies the output filename to write a key to or standard output if this option is not specified. If any encryption options are set then a pass phrase will be prompted for. The output filename should not be the same as the input filename. 如果未指定此选项,则指定将密钥写入或输出的输出文件名。 如果设置了任何加密选项, 则会提示输入密码。 输出文件名不能与输入文件名相同。
To remove the pass phrase on an RSA private key:
gmssl pkey -in key.pem -out keyout.pem
To encrypt a private key using triple DES:
gmssl pkey -in key.pem -des3 -out keyout.pem
To convert a private key from PEM to DER format:
gmssl pkey -in key.pem -outform DER -out keyout.der
To print out the components of a private key to standard output:
gmssl pkey -in key.pem -text -noout
To print out the public components of a private key to standard output:
gmssl pkey -in key.pem -text_pub -noout
To just output the public part of a private key:
gmssl pkey -in key.pem -pubout -out pubkey.pem
Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the GmSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at https://www.openssl.org/source/license.html.