{
    "content": [
        {
            "type": "text",
            "text": "# openssl-pkey (man)\n\n## NAME\n\nopenssl-pkey - public or private key processing command\n\n## SYNOPSIS\n\nopenssl pkey [-help] [-engine id] [-provider name] [-provider-path path] [-propquery propq]\n[-check] [-pubcheck] [-in filename|uri] [-inform DER|PEM|P12|ENGINE] [-passin arg] [-pubin]\n[-out filename] [-outform DER|PEM] [-cciipphheerr] [-passout arg] [-traditional] [-pubout] [-noout]\n[-text] [-textpub] [-ecconvform arg] [-ecparamenc arg]\n\n## DESCRIPTION\n\nThis command processes public or private keys. They can be converted between various forms\nand their components printed.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (24 subsections)\n- **EXAMPLES**\n- **SEE ALSO**\n- **HISTORY**\n- **COPYRIGHT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "openssl-pkey",
        "section": "",
        "mode": "man",
        "summary": "openssl-pkey - public or private key processing command",
        "synopsis": "openssl pkey [-help] [-engine id] [-provider name] [-provider-path path] [-propquery propq]\n[-check] [-pubcheck] [-in filename|uri] [-inform DER|PEM|P12|ENGINE] [-passin arg] [-pubin]\n[-out filename] [-outform DER|PEM] [-cciipphheerr] [-passout arg] [-traditional] [-pubout] [-noout]\n[-text] [-textpub] [-ecconvform arg] [-ecparamenc arg]",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Print out a usage message."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "See \"Engine Options\" in openssl(1). This option is deprecated."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "See \"Provider Options\" in openssl(1), provider(7), and property(7)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "This option checks the consistency of a key pair for both public and private components."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "This option checks the correctness of either a public key or the public component of a key pair."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "This specifies the input to read a key from or standard input if this option is not specified. If the key input is encrypted and -passin is not given a pass phrase will be prompted for."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The key input format; unspecified by default. See openssl-format-options(1) for details."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The password source for the key input. For more information about the format of arg see openssl-passphrase-options(1)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "By default a private key is read from the input. With this option only the public components are read."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "This specifies the output filename to save the encoded and/or text output of key or standard output if this option is not specified. If any cipher option is set but no -passout is given then a pass phrase will be prompted for. The output filename should not be the same as the input filename."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The key output format; the default is PEM. See openssl-format-options(1) for details. -cciipphheerr Encrypt the PEM encoded private key with the supplied cipher. Any algorithm name accepted by EVPgetcipherbyname() is acceptable such as aes128. Encryption is not supported for DER output."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The password source for the output file. For more information about the format of arg see openssl-passphrase-options(1)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Normally a private key is written using standard format: this is PKCS#8 form with the appropriate encryption algorithm (if any). If the -traditional option is specified then the older \"traditional\" format is used instead."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "By default the private and public key is output; this option restricts the output to the public components. This option is automatically set if the input is a public key. When combined with -text, this is equivalent to -textpub."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Do not output the key in encoded form."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Output the various key components in plain text (possibly in addition to the PEM encoded form). This cannot be combined with encoded output in DER format."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Output in text form only the public key components (also for private keys). This cannot be combined with encoded output in DER format."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "This option only applies to elliptic-curve based keys. This specifies how the points on the elliptic curve are converted into octet strings. Possible values are: compressed (the default value), uncompressed and hybrid. For more information regarding the point conversion forms please read the X9.62 standard. Note Due to patent issues the compressed option is disabled by default for binary curves and can be enabled by defining the preprocessor macro OPENSSLECBINPTCOMP at compile time."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "This option only applies to elliptic curve based public and private keys. This specifies how the elliptic curve parameters are encoded. Possible value are: namedcurve, i.e. the ec parameters are specified by an OID, or explicit where the ec parameters are explicitly given (see RFC 3279 for the definition of the EC parameters structures). The default value is namedcurve. Note the implicitlyCA alternative, as specified in RFC 3279, is currently not implemented in OpenSSL."
            }
        ],
        "examples": [
            "To remove the pass phrase on a private key:",
            "openssl pkey -in key.pem -out keyout.pem",
            "To encrypt a private key using triple DES:",
            "openssl pkey -in key.pem -des3 -out keyout.pem",
            "To convert a private key from PEM to DER format:",
            "openssl pkey -in key.pem -outform DER -out keyout.der",
            "To print out the components of a private key to standard output:",
            "openssl pkey -in key.pem -text -noout",
            "To print out the public components of a private key to standard output:",
            "openssl pkey -in key.pem -textpub -noout",
            "To just output the public part of a private key:",
            "openssl pkey -in key.pem -pubout -out pubkey.pem",
            "To change the EC parameters encoding to explicit:",
            "openssl pkey -in key.pem -ecparamenc explicit -out keyout.pem",
            "To change the EC point conversion form to compressed:",
            "openssl pkey -in key.pem -ecconvform compressed -out keyout.pem"
        ],
        "see_also": [
            {
                "name": "openssl",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/openssl/1/json"
            },
            {
                "name": "openssl-genpkey",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/openssl-genpkey/1/json"
            },
            {
                "name": "openssl-rsa",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/openssl-rsa/1/json"
            },
            {
                "name": "openssl-pkcs8",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/openssl-pkcs8/1/json"
            },
            {
                "name": "openssl-dsa",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/openssl-dsa/1/json"
            },
            {
                "name": "openssl-genrsa",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/openssl-genrsa/1/json"
            },
            {
                "name": "openssl-gendsa",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/openssl-gendsa/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "General options",
                        "lines": 1
                    },
                    {
                        "name": "-help",
                        "lines": 2
                    },
                    {
                        "name": "-engine",
                        "lines": 2
                    },
                    {
                        "name": "-provider",
                        "lines": 1
                    },
                    {
                        "name": "-provider-path",
                        "lines": 1
                    },
                    {
                        "name": "-propquery",
                        "lines": 2
                    },
                    {
                        "name": "-check",
                        "lines": 2
                    },
                    {
                        "name": "-pubcheck",
                        "lines": 3
                    },
                    {
                        "name": "Input options",
                        "lines": 1
                    },
                    {
                        "name": "-in",
                        "lines": 4
                    },
                    {
                        "name": "-inform",
                        "lines": 2
                    },
                    {
                        "name": "-passin",
                        "lines": 4
                    },
                    {
                        "name": "-pubin",
                        "lines": 3
                    },
                    {
                        "name": "Output options",
                        "lines": 1
                    },
                    {
                        "name": "-out",
                        "lines": 5
                    },
                    {
                        "name": "-outform",
                        "lines": 7
                    },
                    {
                        "name": "-passout",
                        "lines": 4
                    },
                    {
                        "name": "-traditional",
                        "lines": 4
                    },
                    {
                        "name": "-pubout",
                        "lines": 5
                    },
                    {
                        "name": "-noout",
                        "lines": 2
                    },
                    {
                        "name": "-text",
                        "lines": 3
                    },
                    {
                        "name": "-text",
                        "lines": 3
                    },
                    {
                        "name": "-ec",
                        "lines": 8
                    },
                    {
                        "name": "-ec",
                        "lines": 8
                    }
                ]
            },
            {
                "name": "EXAMPLES",
                "lines": 32,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "HISTORY",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 9,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "openssl-pkey - public or private key processing command\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "openssl pkey [-help] [-engine id] [-provider name] [-provider-path path] [-propquery propq]\n[-check] [-pubcheck] [-in filename|uri] [-inform DER|PEM|P12|ENGINE] [-passin arg] [-pubin]\n[-out filename] [-outform DER|PEM] [-cciipphheerr] [-passout arg] [-traditional] [-pubout] [-noout]\n[-text] [-textpub] [-ecconvform arg] [-ecparamenc arg]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This command processes public or private keys. They can be converted between various forms\nand their components printed.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "General options",
                        "content": ""
                    },
                    {
                        "name": "-help",
                        "content": "Print out a usage message.\n"
                    },
                    {
                        "name": "-engine",
                        "content": "See \"Engine Options\" in openssl(1).  This option is deprecated.\n"
                    },
                    {
                        "name": "-provider",
                        "content": ""
                    },
                    {
                        "name": "-provider-path",
                        "content": ""
                    },
                    {
                        "name": "-propquery",
                        "content": "See \"Provider Options\" in openssl(1), provider(7), and property(7).\n"
                    },
                    {
                        "name": "-check",
                        "content": "This option checks the consistency of a key pair for both public and private components.\n"
                    },
                    {
                        "name": "-pubcheck",
                        "content": "This option checks the correctness of either a public key or the public component of a\nkey pair.\n"
                    },
                    {
                        "name": "Input options",
                        "content": ""
                    },
                    {
                        "name": "-in",
                        "content": "This specifies the input to read a key from or standard input if this option is not\nspecified.  If the key input is encrypted and -passin is not given a pass phrase will be\nprompted for.\n"
                    },
                    {
                        "name": "-inform",
                        "content": "The key input format; unspecified by default.  See openssl-format-options(1) for details.\n"
                    },
                    {
                        "name": "-passin",
                        "content": "The password source for the key input.\n\nFor more information about the format of arg see openssl-passphrase-options(1).\n"
                    },
                    {
                        "name": "-pubin",
                        "content": "By default a private key is read from the input.  With this option only the public\ncomponents are read.\n"
                    },
                    {
                        "name": "Output options",
                        "content": ""
                    },
                    {
                        "name": "-out",
                        "content": "This specifies the output filename to save the encoded and/or text output of key or\nstandard output if this option is not specified.  If any cipher option is set but no\n-passout is given then a pass phrase will be prompted for.  The output filename should\nnot be the same as the input filename.\n"
                    },
                    {
                        "name": "-outform",
                        "content": "The key output format; the default is PEM.  See openssl-format-options(1) for details.\n\n-cciipphheerr\nEncrypt the PEM encoded private key with the supplied cipher. Any algorithm name accepted\nby EVPgetcipherbyname() is acceptable such as aes128.  Encryption is not supported for\nDER output.\n"
                    },
                    {
                        "name": "-passout",
                        "content": "The password source for the output file.\n\nFor more information about the format of arg see openssl-passphrase-options(1).\n"
                    },
                    {
                        "name": "-traditional",
                        "content": "Normally a private key is written using standard format: this is PKCS#8 form with the\nappropriate encryption algorithm (if any). If the -traditional option is specified then\nthe older \"traditional\" format is used instead.\n"
                    },
                    {
                        "name": "-pubout",
                        "content": "By default the private and public key is output; this option restricts the output to the\npublic components.  This option is automatically set if the input is a public key.\n\nWhen combined with -text, this is equivalent to -textpub.\n"
                    },
                    {
                        "name": "-noout",
                        "content": "Do not output the key in encoded form.\n"
                    },
                    {
                        "name": "-text",
                        "content": "Output the various key components in plain text (possibly in addition to the PEM encoded\nform).  This cannot be combined with encoded output in DER format.\n"
                    },
                    {
                        "name": "-text",
                        "content": "Output in text form only the public key components (also for private keys).  This cannot\nbe combined with encoded output in DER format.\n"
                    },
                    {
                        "name": "-ec",
                        "content": "This option only applies to elliptic-curve based keys.\n\nThis specifies how the points on the elliptic curve are converted into octet strings.\nPossible values are: compressed (the default value), uncompressed and hybrid. For more\ninformation regarding the point conversion forms please read the X9.62 standard.  Note\nDue to patent issues the compressed option is disabled by default for binary curves and\ncan be enabled by defining the preprocessor macro OPENSSLECBINPTCOMP at compile time.\n"
                    },
                    {
                        "name": "-ec",
                        "content": "This option only applies to elliptic curve based public and private keys.\n\nThis specifies how the elliptic curve parameters are encoded.  Possible value are:\nnamedcurve, i.e. the ec parameters are specified by an OID, or explicit where the ec\nparameters are explicitly given (see RFC 3279 for the definition of the EC parameters\nstructures). The default value is namedcurve.  Note the implicitlyCA alternative, as\nspecified in RFC 3279, is currently not implemented in OpenSSL.\n"
                    }
                ]
            },
            "EXAMPLES": {
                "content": "To remove the pass phrase on a private key:\n\nopenssl pkey -in key.pem -out keyout.pem\n\nTo encrypt a private key using triple DES:\n\nopenssl pkey -in key.pem -des3 -out keyout.pem\n\nTo convert a private key from PEM to DER format:\n\nopenssl pkey -in key.pem -outform DER -out keyout.der\n\nTo print out the components of a private key to standard output:\n\nopenssl pkey -in key.pem -text -noout\n\nTo print out the public components of a private key to standard output:\n\nopenssl pkey -in key.pem -textpub -noout\n\nTo just output the public part of a private key:\n\nopenssl pkey -in key.pem -pubout -out pubkey.pem\n\nTo change the EC parameters encoding to explicit:\n\nopenssl pkey -in key.pem -ecparamenc explicit -out keyout.pem\n\nTo change the EC point conversion form to compressed:\n\nopenssl pkey -in key.pem -ecconvform compressed -out keyout.pem\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "openssl(1), openssl-genpkey(1), openssl-rsa(1), openssl-pkcs8(1), openssl-dsa(1),\nopenssl-genrsa(1), openssl-gendsa(1)\n",
                "subsections": []
            },
            "HISTORY": {
                "content": "The -engine option was deprecated in OpenSSL 3.0.\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.\n\nLicensed under the Apache License 2.0 (the \"License\").  You may not use this file except in\ncompliance with the License.  You can obtain a copy in the file LICENSE in the source\ndistribution or at <https://www.openssl.org/source/license.html>.\n\n\n\n3.0.2                                        2026-06-02                           OPENSSL-PKEY(1SSL)",
                "subsections": []
            }
        }
    }
}