{
    "mode": "man",
    "parameter": "openssl-dhparam",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/openssl-dhparam/1/json",
    "generated": "2026-08-16T14:50:43Z",
    "synopsis": "openssl dhparam [-help] [-inform DER|PEM] [-outform DER|PEM] [-in filename] [-out filename]\n[-dsaparam] [-check] [-noout] [-text] [-2] [-3] [-5] [-engine id] [-rand files] [-writerand\nfile] [-provider name] [-provider-path path] [-propquery propq] [numbits]",
    "sections": {
        "NAME": {
            "content": "openssl-dhparam - DH parameter manipulation and generation\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "openssl dhparam [-help] [-inform DER|PEM] [-outform DER|PEM] [-in filename] [-out filename]\n[-dsaparam] [-check] [-noout] [-text] [-2] [-3] [-5] [-engine id] [-rand files] [-writerand\nfile] [-provider name] [-provider-path path] [-propquery propq] [numbits]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This command is used to manipulate DH parameter files.\n\nSee \"EXAMPLES\" in openssl-genpkey(1) for examples on how to generate a key using a named safe\nprime group without generating intermediate parameters.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-help",
                    "content": "Print out a usage message.\n"
                },
                {
                    "name": "-inform DER -outform DER",
                    "content": "The  input  format  and output format; the default is PEM.  The object is compatible with\nthe PKCS#3 DHparameter structure.  See openssl-format-options(1) for details.\n"
                },
                {
                    "name": "-in _",
                    "content": "This specifies the input filename to read parameters  from  or  standard  input  if  this\noption is not specified.\n"
                },
                {
                    "name": "-out _",
                    "content": "This  specifies the output filename parameters to. Standard output is used if this option\nis not present. The output filename should not be the same as the input filename.\n"
                },
                {
                    "name": "-dsaparam",
                    "content": "If this option is used, DSA rather than DH parameters  are  read  or  created;  they  are\nconverted  to  DH  format.   Otherwise, \"strong\" primes (such that (p-1)/2 is also prime)\nwill be used for DH parameter generation.\n\nDH parameter generation with the -dsaparam option is much  faster,  and  the  recommended\nexponent length is shorter, which makes DH key exchange more efficient.  Beware that with\nsuch  DSA-style  DH  parameters,  a  fresh DH key should be created for each use to avoid\nsmall-subgroup attacks that may be possible otherwise.\n"
                },
                {
                    "name": "-check",
                    "content": "Performs numerous checks to see if the supplied  parameters  are  valid  and  displays  a\nwarning if not.\n"
                },
                {
                    "name": "-2 -3 -5",
                    "content": "The  generator  to  use,  either 2, 3 or 5. If present then the input file is ignored and\nparameters are generated instead. If not present but numbits is present,  parameters  are\ngenerated with the default generator 2.\n\nnumbits\nThis  option  specifies that a parameter set should be generated of size numbits. It must\nbe the last option. If this option  is  present  then  the  input  file  is  ignored  and\nparameters  are  generated instead. If this option is not present but a generator (-2, -3\nor -5) is present, parameters are generated with a default  length  of  2048  bits.   The\nminimum length is 512 bits. The maximum length is 10000 bits.\n",
                    "flag": "-5"
                },
                {
                    "name": "-noout",
                    "content": "This option inhibits the output of the encoded version of the parameters.\n"
                },
                {
                    "name": "-text",
                    "content": "This option prints out the DH parameters in human readable form.\n"
                },
                {
                    "name": "-engine _",
                    "content": "See \"Engine Options\" in openssl(1).  This option is deprecated.\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"
                }
            ]
        },
        "NOTES": {
            "content": "This command replaces the dh and gendh commands of previous releases.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "openssl(1), openssl-pkeyparam(1), openssl-dsaparam(1), openssl-genpkey(1).\n",
            "subsections": []
        },
        "HISTORY": {
            "content": "The -engine option was deprecated in OpenSSL 3.0.\n\nThe -C option was removed in OpenSSL 3.0.\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright 2000-2023 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-DHPARAM(1SSL)",
            "subsections": []
        }
    },
    "summary": "openssl-dhparam - DH parameter manipulation and generation",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Print out a usage message."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "The input format and output format; the default is PEM. The object is compatible with the PKCS#3 DHparameter structure. See openssl-format-options(1) for details."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This specifies the input filename to read parameters from or standard input if this option is not specified."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This specifies the output filename parameters to. Standard output is used if this option is not present. The output filename should not be the same as the input filename."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "If this option is used, DSA rather than DH parameters are read or created; they are converted to DH format. Otherwise, \"strong\" primes (such that (p-1)/2 is also prime) will be used for DH parameter generation. DH parameter generation with the -dsaparam option is much faster, and the recommended exponent length is shorter, which makes DH key exchange more efficient. Beware that with such DSA-style DH parameters, a fresh DH key should be created for each use to avoid small-subgroup attacks that may be possible otherwise."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Performs numerous checks to see if the supplied parameters are valid and displays a warning if not."
        },
        {
            "flag": "-5",
            "long": null,
            "arg": null,
            "description": "The generator to use, either 2, 3 or 5. If present then the input file is ignored and parameters are generated instead. If not present but numbits is present, parameters are generated with the default generator 2. numbits This option specifies that a parameter set should be generated of size numbits. It must be the last option. If this option is present then the input file is ignored and parameters are generated instead. If this option is not present but a generator (-2, -3 or -5) is present, parameters are generated with a default length of 2048 bits. The minimum length is 512 bits. The maximum length is 10000 bits."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option inhibits the output of the encoded version of the parameters."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option prints out the DH parameters in human readable form."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "See \"Engine Options\" in openssl(1). This option is deprecated."
        },
        {
            "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)."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "openssl",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/openssl/1/json"
        },
        {
            "name": "openssl-pkeyparam",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/openssl-pkeyparam/1/json"
        },
        {
            "name": "openssl-dsaparam",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/openssl-dsaparam/1/json"
        },
        {
            "name": "openssl-genpkey",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/openssl-genpkey/1/json"
        }
    ]
}