{
    "content": [
        {
            "type": "text",
            "text": "# OPENSSL-PKEYUTL (man)\n\n## NAME\n\nopenssl-pkeyutl - public key algorithm command\n\n## SYNOPSIS\n\nopenssl pkeyutl [-help] [-in file] [-rawin] [-digest algorithm] [-out file] [-sigfile file]\n[-inkey filename|uri] [-keyform DER|PEM|P12|ENGINE] [-passin arg] [-peerkey file] [-peerform\nDER|PEM|P12|ENGINE] [-pubin] [-certin] [-rev] [-sign] [-verify] [-verifyrecover] [-encrypt]\n[-decrypt] [-derive] [-kdf algorithm] [-kdflen length] [-pkeyopt opt:value] [-pkeyoptpassin\nopt[:passarg]] [-hexdump] [-asn1parse] [-engine id] [-engineimpl] [-rand files] [-writerand\nfile] [-provider name] [-provider-path path] [-propquery propq] [-config configfile]\n\n## DESCRIPTION\n\nThis command can be used to perform low-level public key operations using any supported\nalgorithm.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (33 subsections)\n- **NOTES**\n- **RSA ALGORITHM**\n- **RSA-PSS ALGORITHM**\n- **DSA ALGORITHM**\n- **DH ALGORITHM**\n- **EC ALGORITHM**\n- **X25519 AND X448 ALGORITHMS**\n- **ED25519 AND ED448 ALGORITHMS**\n- **SM2** (1 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-PKEYUTL",
        "section": "",
        "mode": "man",
        "summary": "openssl-pkeyutl - public key algorithm command",
        "synopsis": "openssl pkeyutl [-help] [-in file] [-rawin] [-digest algorithm] [-out file] [-sigfile file]\n[-inkey filename|uri] [-keyform DER|PEM|P12|ENGINE] [-passin arg] [-peerkey file] [-peerform\nDER|PEM|P12|ENGINE] [-pubin] [-certin] [-rev] [-sign] [-verify] [-verifyrecover] [-encrypt]\n[-decrypt] [-derive] [-kdf algorithm] [-kdflen length] [-pkeyopt opt:value] [-pkeyoptpassin\nopt[:passarg]] [-hexdump] [-asn1parse] [-engine id] [-engineimpl] [-rand files] [-writerand\nfile] [-provider name] [-provider-path path] [-propquery propq] [-config configfile]",
        "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": "This specifies the input filename to read data from or standard input if this option is not specified."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "This indicates that the input data is raw data, which is not hashed by any message digest algorithm. The user can specify a digest algorithm by using the -digest option. This option can only be used with -sign and -verify and must be used with the Ed25519 and Ed448 algorithms."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "This specifies the digest algorithm which is used to hash the input data before signing or verifying it with the input key. This option could be omitted if the signature algorithm does not require one (for instance, EdDSA). If this option is omitted but the signature algorithm requires one, a default value will be used. For signature algorithms like RSA, DSA and ECDSA, SHA-256 will be the default digest algorithm. For SM2, it will be SM3. If this option is present, then the -rawin option must be also specified."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Specifies the output filename to write to or standard output by default."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Signature file, required for -verify operations only"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The input key, by default it should be a private key."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The key format; unspecified by default. See openssl-format-options(1) for details."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The input key password source. For more information about the format of arg see openssl-passphrase-options(1)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The peer key file, used by key derivation (agreement) operations."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The peer key format; unspecified by default. See openssl-format-options(1) for details."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The input file is a public key."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "The input is a certificate containing a public key."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Reverse the order of the input buffer. This is useful for some libraries (such as CryptoAPI) which represent the buffer in little endian format."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Sign the input data (which must be a hash) and output the signed result. This requires a private key."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Verify the input data (which must be a hash) against the signature file and indicate if the verification succeeded or failed."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Verify the input data (which must be a hash) and output the recovered data."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Encrypt the input data using a public key."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Decrypt the input data using a private key."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Derive a shared secret using the peer key."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Use key derivation function algorithm. The supported algorithms are at present TLS1-PRF and HKDF. Note: additional parameters and the KDF output length will normally have to be set for this to work. See EVPPKEYCTXsethkdfmd(3) and EVPPKEYCTXsettls1prfmd(3) for the supported string parameters of each algorithm."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Set the output length for KDF."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Public key options specified as opt:value. See NOTES below for more details."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Allows reading a public key option opt from stdin or a password source. If only opt is specified, the user will be prompted to enter a password on stdin. Alternatively, passarg can be specified which can be any value supported by openssl-passphrase-options(1)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "hex dump the output data."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Parse the ASN.1 output data, this is useful when combined with the -verifyrecover option when an ASN1 structure is signed."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "See \"Engine Options\" in openssl(1). This option is deprecated."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "When used with the -engine option, it specifies to also use engine id for crypto operations."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "See \"Random State Options\" in openssl(1) for details."
            },
            {
                "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": "See \"Configuration Option\" in openssl(1)."
            }
        ],
        "examples": [
            "Sign some data using a private key:",
            "openssl pkeyutl -sign -in file -inkey key.pem -out sig",
            "Recover the signed data (e.g. if an RSA key is used):",
            "openssl pkeyutl -verifyrecover -in sig -inkey key.pem",
            "Verify the signature (e.g. a DSA key):",
            "openssl pkeyutl -verify -in file -sigfile sig -inkey key.pem",
            "Sign data using a message digest value (this is currently only valid for RSA):",
            "openssl pkeyutl -sign -in file -inkey key.pem -out sig -pkeyopt digest:sha256",
            "Derive a shared secret value:",
            "openssl pkeyutl -derive -inkey key.pem -peerkey pubkey.pem -out secret",
            "Hexdump 48 bytes of TLS1 PRF using digest SHA256 and shared secret and seed consisting of the",
            "single byte 0xFF:",
            "openssl pkeyutl -kdf TLS1-PRF -kdflen 48 -pkeyopt md:SHA256 \\",
            "-pkeyopt hexsecret:ff -pkeyopt hexseed:ff -hexdump",
            "Derive a key using scrypt where the password is read from command line:",
            "openssl pkeyutl -kdf scrypt -kdflen 16 -pkeyoptpassin pass \\",
            "-pkeyopt hexsalt:aabbcc -pkeyopt N:16384 -pkeyopt r:8 -pkeyopt p:1",
            "Derive using the same algorithm, but read key from environment variable MYPASS:",
            "openssl pkeyutl -kdf scrypt -kdflen 16 -pkeyoptpassin pass:env:MYPASS \\",
            "-pkeyopt hexsalt:aabbcc -pkeyopt N:16384 -pkeyopt r:8 -pkeyopt p:1",
            "Sign some data using an SM2(7) private key and a specific ID:",
            "openssl pkeyutl -sign -in file -inkey sm2.key -out sig -rawin -digest sm3 \\",
            "-pkeyopt distid:someid",
            "Verify some data using an SM2(7) certificate and a specific ID:",
            "openssl pkeyutl -verify -certin -in file -inkey sm2.cert -sigfile sig \\",
            "-rawin -digest sm3 -pkeyopt distid:someid",
            "Decrypt some data using a private key with OAEP padding using SHA256:",
            "openssl pkeyutl -decrypt -in file -inkey key.pem -out secret \\",
            "-pkeyopt rsapaddingmode:oaep -pkeyopt rsaoaepmd:sha256"
        ],
        "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-pkey",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/openssl-pkey/1/json"
            },
            {
                "name": "openssl-rsautl",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/openssl-rsautl/1/json"
            },
            {
                "name": "openssl-dgst",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/openssl-dgst/1/json"
            },
            {
                "name": "openssl-rsa",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/openssl-rsa/1/json"
            },
            {
                "name": "openssl-genrsa",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/openssl-genrsa/1/json"
            },
            {
                "name": "openssl-kdf",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/openssl-kdf/1/json"
            },
            {
                "name": "EVPPKEYCTXsethkdfmd",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/EVPPKEYCTXsethkdfmd/3/json"
            },
            {
                "name": "EVPPKEYCTXsettls1prfmd",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/EVPPKEYCTXsettls1prfmd/3/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-help",
                        "lines": 2
                    },
                    {
                        "name": "-in _",
                        "lines": 3
                    },
                    {
                        "name": "-rawin",
                        "lines": 5
                    },
                    {
                        "name": "-digest _",
                        "lines": 7
                    },
                    {
                        "name": "-out _",
                        "lines": 2
                    },
                    {
                        "name": "-sigfile _",
                        "lines": 2
                    },
                    {
                        "name": "-inkey _",
                        "lines": 2
                    },
                    {
                        "name": "-keyform DER",
                        "lines": 2
                    },
                    {
                        "name": "-passin _",
                        "lines": 3
                    },
                    {
                        "name": "-peerkey _",
                        "lines": 2
                    },
                    {
                        "name": "-peerform DER",
                        "lines": 2
                    },
                    {
                        "name": "-pubin",
                        "lines": 2
                    },
                    {
                        "name": "-certin",
                        "lines": 2
                    },
                    {
                        "name": "-rev",
                        "lines": 3
                    },
                    {
                        "name": "-sign",
                        "lines": 3
                    },
                    {
                        "name": "-verify",
                        "lines": 3
                    },
                    {
                        "name": "-verifyrecover",
                        "lines": 2
                    },
                    {
                        "name": "-encrypt",
                        "lines": 2
                    },
                    {
                        "name": "-decrypt",
                        "lines": 2
                    },
                    {
                        "name": "-derive",
                        "lines": 2
                    },
                    {
                        "name": "-kdf _",
                        "lines": 5
                    },
                    {
                        "name": "-kdflen _",
                        "lines": 2
                    },
                    {
                        "name": "-pkeyopt _",
                        "lines": 2
                    },
                    {
                        "name": "-pkeyopt_passin _",
                        "lines": 5
                    },
                    {
                        "name": "-hexdump",
                        "lines": 2
                    },
                    {
                        "name": "-asn1parse",
                        "lines": 3
                    },
                    {
                        "name": "-engine _",
                        "lines": 2
                    },
                    {
                        "name": "-engine_impl",
                        "lines": 3
                    },
                    {
                        "name": "-rand _ -writerand _",
                        "lines": 2
                    },
                    {
                        "name": "-provider _",
                        "lines": 1
                    },
                    {
                        "name": "-provider-path _",
                        "lines": 1
                    },
                    {
                        "name": "-propquery _",
                        "lines": 2
                    },
                    {
                        "name": "-config _",
                        "lines": 2
                    }
                ]
            },
            {
                "name": "NOTES",
                "lines": 20,
                "subsections": []
            },
            {
                "name": "RSA ALGORITHM",
                "lines": 44,
                "subsections": []
            },
            {
                "name": "RSA-PSS ALGORITHM",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "DSA ALGORITHM",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "DH ALGORITHM",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "EC ALGORITHM",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "X25519 AND X448 ALGORITHMS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "ED25519 AND ED448 ALGORITHMS",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "SM2",
                "lines": 2,
                "subsections": [
                    {
                        "name": "-pkeyopt",
                        "lines": 11
                    }
                ]
            },
            {
                "name": "EXAMPLES",
                "lines": 51,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "HISTORY",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 7,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "openssl-pkeyutl - public key algorithm command\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "openssl pkeyutl [-help] [-in file] [-rawin] [-digest algorithm] [-out file] [-sigfile file]\n[-inkey filename|uri] [-keyform DER|PEM|P12|ENGINE] [-passin arg] [-peerkey file] [-peerform\nDER|PEM|P12|ENGINE] [-pubin] [-certin] [-rev] [-sign] [-verify] [-verifyrecover] [-encrypt]\n[-decrypt] [-derive] [-kdf algorithm] [-kdflen length] [-pkeyopt opt:value] [-pkeyoptpassin\nopt[:passarg]] [-hexdump] [-asn1parse] [-engine id] [-engineimpl] [-rand files] [-writerand\nfile] [-provider name] [-provider-path path] [-propquery propq] [-config configfile]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This command can be used to perform low-level public key operations using any supported\nalgorithm.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-help",
                        "content": "Print out a usage message.\n"
                    },
                    {
                        "name": "-in _",
                        "content": "This  specifies  the input filename to read data from or standard input if this option is\nnot specified.\n"
                    },
                    {
                        "name": "-rawin",
                        "content": "This indicates that the input data is raw data, which is not hashed by any message digest\nalgorithm. The user can specify a digest algorithm by  using  the  -digest  option.  This\noption  can  only  be  used  with -sign and -verify and must be used with the Ed25519 and\nEd448 algorithms.\n"
                    },
                    {
                        "name": "-digest _",
                        "content": "This specifies the digest algorithm which is used to hash the input data  before  signing\nor  verifying  it  with  the  input  key.  This  option could be omitted if the signature\nalgorithm does not require one (for instance, EdDSA). If this option is omitted  but  the\nsignature  algorithm requires one, a default value will be used. For signature algorithms\nlike RSA, DSA and ECDSA, SHA-256 will be the default digest algorithm. For SM2,  it  will\nbe SM3. If this option is present, then the -rawin option must be also specified.\n"
                    },
                    {
                        "name": "-out _",
                        "content": "Specifies the output filename to write to or standard output by default.\n"
                    },
                    {
                        "name": "-sigfile _",
                        "content": "Signature file, required for -verify operations only\n"
                    },
                    {
                        "name": "-inkey _",
                        "content": "The input key, by default it should be a private key.\n"
                    },
                    {
                        "name": "-keyform DER",
                        "content": "The key format; unspecified by default.  See openssl-format-options(1) for details.\n"
                    },
                    {
                        "name": "-passin _",
                        "content": "The  input  key  password  source.  For  more  information  about  the  format of arg see\nopenssl-passphrase-options(1).\n"
                    },
                    {
                        "name": "-peerkey _",
                        "content": "The peer key file, used by key derivation (agreement) operations.\n"
                    },
                    {
                        "name": "-peerform DER",
                        "content": "The peer key format; unspecified by default.  See openssl-format-options(1) for details.\n"
                    },
                    {
                        "name": "-pubin",
                        "content": "The input file is a public key.\n"
                    },
                    {
                        "name": "-certin",
                        "content": "The input is a certificate containing a public key.\n"
                    },
                    {
                        "name": "-rev",
                        "content": "Reverse the order of the input buffer.  This  is  useful  for  some  libraries  (such  as\nCryptoAPI) which represent the buffer in little endian format.\n"
                    },
                    {
                        "name": "-sign",
                        "content": "Sign  the input data (which must be a hash) and output the signed result. This requires a\nprivate key.\n"
                    },
                    {
                        "name": "-verify",
                        "content": "Verify the input data (which must be a hash) against the signature file and  indicate  if\nthe verification succeeded or failed.\n"
                    },
                    {
                        "name": "-verifyrecover",
                        "content": "Verify the input data (which must be a hash) and output the recovered data.\n"
                    },
                    {
                        "name": "-encrypt",
                        "content": "Encrypt the input data using a public key.\n"
                    },
                    {
                        "name": "-decrypt",
                        "content": "Decrypt the input data using a private key.\n"
                    },
                    {
                        "name": "-derive",
                        "content": "Derive a shared secret using the peer key.\n"
                    },
                    {
                        "name": "-kdf _",
                        "content": "Use  key derivation function algorithm.  The supported algorithms are at present TLS1-PRF\nand HKDF.  Note: additional parameters and the KDF output length will normally have to be\nset     for     this     to     work.       See      EVPPKEYCTXsethkdfmd(3)      and\nEVPPKEYCTXsettls1prfmd(3) for the supported string parameters of each algorithm.\n"
                    },
                    {
                        "name": "-kdflen _",
                        "content": "Set the output length for KDF.\n"
                    },
                    {
                        "name": "-pkeyopt _",
                        "content": "Public key options specified as opt:value. See NOTES below for more details.\n"
                    },
                    {
                        "name": "-pkeyopt_passin _",
                        "content": "Allows  reading  a public key option opt from stdin or a password source.  If only opt is\nspecified, the user will be prompted  to  enter  a  password  on  stdin.   Alternatively,\npassarg    can    be    specified    which    can    be    any    value    supported   by\nopenssl-passphrase-options(1).\n"
                    },
                    {
                        "name": "-hexdump",
                        "content": "hex dump the output data.\n"
                    },
                    {
                        "name": "-asn1parse",
                        "content": "Parse the ASN.1 output data, this is useful when combined with the -verifyrecover  option\nwhen an ASN1 structure is signed.\n"
                    },
                    {
                        "name": "-engine _",
                        "content": "See \"Engine Options\" in openssl(1).  This option is deprecated.\n"
                    },
                    {
                        "name": "-engine_impl",
                        "content": "When  used  with  the  -engine  option,  it  specifies  to  also use engine id for crypto\noperations.\n"
                    },
                    {
                        "name": "-rand _ -writerand _",
                        "content": "See \"Random State Options\" in openssl(1) for details.\n"
                    },
                    {
                        "name": "-provider _",
                        "content": ""
                    },
                    {
                        "name": "-provider-path _",
                        "content": ""
                    },
                    {
                        "name": "-propquery _",
                        "content": "See \"Provider Options\" in openssl(1), provider(7), and property(7).\n"
                    },
                    {
                        "name": "-config _",
                        "content": "See \"Configuration Option\" in openssl(1).\n"
                    }
                ]
            },
            "NOTES": {
                "content": "The  operations  and  options  supported  vary  according  to  the  key  algorithm  and   its\nimplementation. The OpenSSL operations and options are indicated below.\n\nUnless  otherwise  mentioned all algorithms support the digest:alg option which specifies the\ndigest in use for sign, verify and verifyrecover operations.  The value alg should  represent\na  digest name as used in the EVPgetdigestbyname() function for example sha1. This value is\nnot used to hash the input data. It is used (by  some  algorithms)  for  sanity-checking  the\nlengths  of  data  passed in and for creating the structures that make up the signature (e.g.\nDigestInfo in RSASSA PKCS#1 v1.5 signatures).\n\nThis command does not hash the input data (except where -rawin is used) but  rather  it  will\nuse  the  data  directly  as  input  to  the signature algorithm.  Depending on the key type,\nsignature type, and mode of padding, the maximum acceptable lengths of input data differ. The\nsigned data can't be longer than the key modulus with RSA. In case of ECDSA and DSA the  data\nshouldn't be longer than the field size, otherwise it will be silently truncated to the field\nsize.  In any event the input size must not be larger than the largest supported digest size.\n\nIn  other  words, if the value of digest is sha1 the input should be the 20 bytes long binary\nencoding of the SHA-1 hash function output.\n",
                "subsections": []
            },
            "RSA ALGORITHM": {
                "content": "The RSA algorithm generally supports the encrypt, decrypt,  sign,  verify  and  verifyrecover\noperations.  However,  some  padding  modes  support  only  a subset of these operations. The\nfollowing additional pkeyopt values are supported:\n\nrsapaddingmode:mode\nThis sets the RSA padding mode. Acceptable values for mode are pkcs1 for PKCS#1  padding,\nnone for no padding, oaep for OAEP mode, x931 for X9.31 mode and pss for PSS.\n\nIn  PKCS#1 padding, if the message digest is not set, then the supplied data is signed or\nverified directly instead of using a DigestInfo structure. If a digest is set,  then  the\nDigestInfo structure is used and its length must correspond to the digest type.\n\nNote,  for  pkcs1  padding, as a protection against Bleichenbacher attack, the decryption\nwill not fail in case of padding check failures. Use none and manual  inspection  of  the\ndecrypted message to verify if the decrypted value has correct PKCS#1 v1.5 padding.\n\nFor oaep mode only encryption and decryption is supported.\n\nFor  x931  if  the  digest  type is set it is used to format the block data otherwise the\nfirst byte is used to specify the X9.31 digest ID. Sign, verify and verifyrecover are can\nbe performed in this mode.\n\nFor pss mode only sign and verify are supported and the digest type must be specified.\n\nrsapsssaltlen:len\nFor pss mode only this option  specifies  the  salt  length.  Three  special  values  are\nsupported:  digest sets the salt length to the digest length, max sets the salt length to\nthe maximum permissible  value.  When  verifying  auto  causes  the  salt  length  to  be\nautomatically determined based on the PSS block structure.\n\nrsamgf1md:digest\nFor  PSS  and OAEP padding sets the MGF1 digest. If the MGF1 digest is not explicitly set\nin PSS mode then the signing digest is used.\n\nrsaoaepmd:digest\nSets the digest used for the OAEP hash function. If not explicitly set then SHA1 is used.\n\nrsapkcs1implicitrejection:flag\nDisables (when set to 0) or enables (when set to 1) the use of  implicit  rejection  with\nPKCS#1   v1.5   decryption.   When   enabled  (the  default),  as  a  protection  against\nBleichenbacher attack, the library will generate a deterministic random plaintext that it\nwill return to the caller in case of padding check  failure.   When  disabled,  it's  the\ncallers' responsibility to handle the returned errors in a side-channel free manner.\n",
                "subsections": []
            },
            "RSA-PSS ALGORITHM": {
                "content": "The  RSA-PSS  algorithm  is a restricted version of the RSA algorithm which only supports the\nsign and verify operations with PSS padding. The following  additional  -pkeyopt  values  are\nsupported:\n\nrsapaddingmode:mode, rsapsssaltlen:len, rsamgf1md:digest\nThese  have  the same meaning as the RSA algorithm with some additional restrictions. The\npadding mode can only be set to pss which is the default value.\n\nIf the key has parameter restrictions than the digest, MGF1 digest and  salt  length  are\nset  to  the values specified in the parameters.  The digest and MG cannot be changed and\nthe salt length cannot be set to a value less than the minimum restriction.\n",
                "subsections": []
            },
            "DSA ALGORITHM": {
                "content": "The DSA algorithm supports signing and verification operations only. Currently there  are  no\nadditional -pkeyopt options other than digest. The SHA1 digest is assumed by default.\n",
                "subsections": []
            },
            "DH ALGORITHM": {
                "content": "The DH algorithm only supports the derivation operation and no additional -pkeyopt options.\n",
                "subsections": []
            },
            "EC ALGORITHM": {
                "content": "The  EC algorithm supports sign, verify and derive operations. The sign and verify operations\nuse ECDSA and derive uses ECDH. SHA1 is assumed by default for the -pkeyopt digest option.\n",
                "subsections": []
            },
            "X25519 AND X448 ALGORITHMS": {
                "content": "The X25519 and X448 algorithms support key derivation only. Currently there are no additional\noptions.\n",
                "subsections": []
            },
            "ED25519 AND ED448 ALGORITHMS": {
                "content": "These algorithms only support signing and  verifying.  OpenSSL  only  implements  the  \"pure\"\nvariants  of these algorithms so raw data can be passed directly to them without hashing them\nfirst. The option -rawin must be used  with  these  algorithms  with  no  -digest  specified.\nAdditionally OpenSSL only supports \"oneshot\" operation with these algorithms. This means that\nthe  entire file to be signed/verified must be read into memory before processing it. Signing\nor Verifying very large files should be avoided. Additionally the size of the  file  must  be\nknown  for  this  to  work.  If the size of the file cannot be determined (for example if the\ninput is stdin) then the sign or verify operation will fail.\n",
                "subsections": []
            },
            "SM2": {
                "content": "The SM2 algorithm supports sign, verify, encrypt and decrypt operations.  For  the  sign  and\nverify  operations,  SM2  requires an Distinguishing ID string to be passed in. The following",
                "subsections": [
                    {
                        "name": "-pkeyopt",
                        "content": "distid:string\nThis sets the ID string used in SM2 sign or verify operations.  While  verifying  an  SM2\nsignature,  the ID string must be the same one used when signing the data.  Otherwise the\nverification will fail.\n\nhexdistid:hexstring\nThis sets the ID string used in SM2 sign or verify operations.  While  verifying  an  SM2\nsignature,  the ID string must be the same one used when signing the data.  Otherwise the\nverification will fail. The ID string  provided  with  this  option  should  be  a  valid\nhexadecimal value.\n"
                    }
                ]
            },
            "EXAMPLES": {
                "content": "Sign some data using a private key:\n\nopenssl pkeyutl -sign -in file -inkey key.pem -out sig\n\nRecover the signed data (e.g. if an RSA key is used):\n\nopenssl pkeyutl -verifyrecover -in sig -inkey key.pem\n\nVerify the signature (e.g. a DSA key):\n\nopenssl pkeyutl -verify -in file -sigfile sig -inkey key.pem\n\nSign data using a message digest value (this is currently only valid for RSA):\n\nopenssl pkeyutl -sign -in file -inkey key.pem -out sig -pkeyopt digest:sha256\n\nDerive a shared secret value:\n\nopenssl pkeyutl -derive -inkey key.pem -peerkey pubkey.pem -out secret\n\nHexdump 48 bytes of TLS1 PRF using digest SHA256 and shared secret and seed consisting of the\nsingle byte 0xFF:\n\nopenssl pkeyutl -kdf TLS1-PRF -kdflen 48 -pkeyopt md:SHA256 \\\n-pkeyopt hexsecret:ff -pkeyopt hexseed:ff -hexdump\n\nDerive a key using scrypt where the password is read from command line:\n\nopenssl pkeyutl -kdf scrypt -kdflen 16 -pkeyoptpassin pass \\\n-pkeyopt hexsalt:aabbcc -pkeyopt N:16384 -pkeyopt r:8 -pkeyopt p:1\n\nDerive using the same algorithm, but read key from environment variable MYPASS:\n\nopenssl pkeyutl -kdf scrypt -kdflen 16 -pkeyoptpassin pass:env:MYPASS \\\n-pkeyopt hexsalt:aabbcc -pkeyopt N:16384 -pkeyopt r:8 -pkeyopt p:1\n\nSign some data using an SM2(7) private key and a specific ID:\n\nopenssl pkeyutl -sign -in file -inkey sm2.key -out sig -rawin -digest sm3 \\\n-pkeyopt distid:someid\n\nVerify some data using an SM2(7) certificate and a specific ID:\n\nopenssl pkeyutl -verify -certin -in file -inkey sm2.cert -sigfile sig \\\n-rawin -digest sm3 -pkeyopt distid:someid\n\nDecrypt some data using a private key with OAEP padding using SHA256:\n\nopenssl pkeyutl -decrypt -in file -inkey key.pem -out secret \\\n-pkeyopt rsapaddingmode:oaep -pkeyopt rsaoaepmd:sha256\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "openssl(1),    openssl-genpkey(1),    openssl-pkey(1),   openssl-rsautl(1)   openssl-dgst(1),\nopenssl-rsa(1),      openssl-genrsa(1),      openssl-kdf(1)      EVPPKEYCTXsethkdfmd(3),\nEVPPKEYCTXsettls1prfmd(3),\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\n3.0.13                                       2026-07-29                        OPENSSL-PKEYUTL(1SSL)",
                "subsections": []
            }
        }
    }
}