{
    "content": [
        {
            "type": "text",
            "text": "# openssl-pkey (info)\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\npath] [-propquery propq] [-check] [-pubcheck] [-in filename|uri]\n[-inform DER|PEM|P12|ENGINE] [-passin arg] [-pubin] [-out filename]\n[-outform DER|PEM] [-cipher] [-passout arg] [-traditional] [-pubout]\n[-noout] [-text] [-textpub] [-ecconvform arg] [-ecparamenc arg]\n\n## DESCRIPTION\n\nThis command processes public or private keys. They can be converted\nbetween various forms and their components printed.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (10 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": "info",
        "summary": "openssl-pkey - public or private key processing command",
        "synopsis": "openssl pkey [-help] [-engine id] [-provider name] [-provider-path\npath] [-propquery propq] [-check] [-pubcheck] [-in filename|uri]\n[-inform DER|PEM|P12|ENGINE] [-passin arg] [-pubin] [-out filename]\n[-outform DER|PEM] [-cipher] [-passout arg] [-traditional] [-pubout]\n[-noout] [-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. -engine id See \"Engine Options\" in openssl(1). This option is deprecated. -provider name -provider-path path -propquery propq 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. Input options -in filename|uri 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. -inform DER|PEM|P12|ENGINE The key input format; unspecified by default. See openssl-format-options(1) for details. -passin arg 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. Output options -out filename 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. -outform DER|PEM The key output format; the default is PEM. See openssl-format-options(1) for details."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "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. -passout arg 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. -ecconvform arg 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. -ecparamenc arg 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": 6,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-help",
                        "lines": 10
                    },
                    {
                        "name": "-check",
                        "lines": 3
                    },
                    {
                        "name": "-pubcheck",
                        "lines": 19
                    },
                    {
                        "name": "-pubin",
                        "lines": 15
                    },
                    {
                        "name": "-cipher",
                        "lines": 10
                    },
                    {
                        "name": "-traditional",
                        "lines": 5
                    },
                    {
                        "name": "-pubout",
                        "lines": 6
                    },
                    {
                        "name": "-noout",
                        "lines": 2
                    },
                    {
                        "name": "-text",
                        "lines": 4
                    },
                    {
                        "name": "-text_pub",
                        "lines": 27
                    }
                ]
            },
            {
                "name": "EXAMPLES",
                "lines": 32,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "HISTORY",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 8,
                "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\npath] [-propquery propq] [-check] [-pubcheck] [-in filename|uri]\n[-inform DER|PEM|P12|ENGINE] [-passin arg] [-pubin] [-out filename]\n[-outform DER|PEM] [-cipher] [-passout arg] [-traditional] [-pubout]\n[-noout] [-text] [-textpub] [-ecconvform arg] [-ecparamenc arg]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This command processes public or private keys. They can be converted\nbetween various forms and their components printed.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "General options",
                "subsections": [
                    {
                        "name": "-help",
                        "content": "Print out a usage message.\n\n-engine id\nSee \"Engine Options\" in openssl(1).  This option is deprecated.\n\n-provider name\n-provider-path path\n-propquery propq\nSee \"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\nand private components.\n"
                    },
                    {
                        "name": "-pubcheck",
                        "content": "This option checks the correctness of either a public key or the\npublic component of a key pair.\n\nInput options\n-in filename|uri\nThis specifies the input to read a key from or standard input if\nthis option is not specified.  If the key input is encrypted and\n-passin is not given a pass phrase will be prompted for.\n\n-inform DER|PEM|P12|ENGINE\nThe key input format; unspecified by default.  See\nopenssl-format-options(1) for details.\n\n-passin arg\nThe password source for the key input.\n\nFor more information about the format of arg see\nopenssl-passphrase-options(1).\n"
                    },
                    {
                        "name": "-pubin",
                        "content": "By default a private key is read from the input.  With this option\nonly the public components are read.\n\nOutput options\n-out filename\nThis specifies the output filename to save the encoded and/or text\noutput of key or standard output if this option is not specified.\nIf any cipher option is set but no -passout is given then a pass\nphrase will be prompted for.  The output filename should not be the\nsame as the input filename.\n\n-outform DER|PEM\nThe key output format; the default is PEM.  See\nopenssl-format-options(1) for details.\n"
                    },
                    {
                        "name": "-cipher",
                        "content": "Encrypt the PEM encoded private key with the supplied cipher. Any\nalgorithm name accepted by EVPgetcipherbyname() is acceptable\nsuch as aes128.  Encryption is not supported for DER output.\n\n-passout arg\nThe password source for the output file.\n\nFor more information about the format of arg see\nopenssl-passphrase-options(1).\n"
                    },
                    {
                        "name": "-traditional",
                        "content": "Normally a private key is written using standard format: this is\nPKCS#8 form with the appropriate encryption algorithm (if any). If\nthe -traditional option is specified then the older \"traditional\"\nformat is used instead.\n"
                    },
                    {
                        "name": "-pubout",
                        "content": "By default the private and public key is output; this option\nrestricts the output to the public components.  This option is\nautomatically 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\naddition to the PEM encoded form).  This cannot be combined with\nencoded output in DER format.\n"
                    },
                    {
                        "name": "-text_pub",
                        "content": "Output in text form only the public key components (also for\nprivate keys).  This cannot be combined with encoded output in DER\nformat.\n\n-ecconvform arg\nThis option only applies to elliptic-curve based keys.\n\nThis specifies how the points on the elliptic curve are converted\ninto octet strings. Possible values are: compressed (the default\nvalue), uncompressed and hybrid. For more information regarding the\npoint conversion forms please read the X9.62 standard.  Note Due to\npatent issues the compressed option is disabled by default for\nbinary curves and can be enabled by defining the preprocessor macro\nOPENSSLECBINPTCOMP at compile time.\n\n-ecparamenc arg\nThis option only applies to elliptic curve based public and private\nkeys.\n\nThis specifies how the elliptic curve parameters are encoded.\nPossible value are: namedcurve, i.e. the ec parameters are\nspecified by an OID, or explicit where the ec parameters are\nexplicitly given (see RFC 3279 for the definition of the EC\nparameters structures). The default value is namedcurve.  Note the\nimplicitlyCA alternative, as specified in RFC 3279, is currently\nnot 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),\nopenssl-dsa(1), openssl-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\nthis file except in compliance with the License.  You can obtain a copy\nin the file LICENSE in the source distribution or at\n<https://www.openssl.org/source/license.html>.\n\n3.0.2                             2026-06-02                OPENSSL-PKEY(1SSL)",
                "subsections": []
            }
        }
    }
}