{
    "content": [
        {
            "type": "text",
            "text": "# EVP_PKEY-FFC(7ssl) (man)\n\n**Summary:** EVPPKEY-FFC - EVPPKEY DSA and DH/DHX shared FFC parameters.\n\n## See Also\n\n- EVPPKEY-DSA(7)\n- EVPPKEY-DH(7)\n- EVPSIGNATURE-DSA(7)\n- EVPKEYEXCH-DH(7)\n- EVPKEYMGMT(3)\n- EVPPKEY(3)\n- provider-keymgmt(7)\n- OSSLPROVIDER-default(7)\n- OSSLPROVIDER-FIPS(7)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **DESCRIPTION** (18 lines) — 4 subsections\n  - FFC parameters (10 lines)\n  - FFC DSA, DH and DHX domain parameters (6 lines)\n  - FFC DSA and DHX domain parameters (38 lines)\n  - FFC key generation parameters (43 lines)\n- **CONFORMING TO** (10 lines)\n- **SEE ALSO** (3 lines)\n- **COPYRIGHT** (9 lines)\n\n## Full Content\n\n### NAME\n\nEVPPKEY-FFC - EVPPKEY DSA and DH/DHX shared FFC parameters.\n\n### DESCRIPTION\n\nFinite field cryptography (FFC) is a method of implementing discrete logarithm cryptography\nusing finite field mathematics. DSA is an example of FFC and Diffie-Hellman key establishment\nalgorithms specified in SP800-56A can also be implemented as FFC.\n\nThe DSA, DH and DHX keytypes are implemented in OpenSSL's default and FIPS providers.  The\nimplementations support the basic DSA, DH and DHX keys, containing the public and private\nkeys pub and priv as well as the three main domain parameters p, q and g.\n\nFor DSA (and DH that is not a named group) the FIPS186-4 standard specifies that the values\nused for FFC parameter generation are also required for parameter validation.  This means\nthat optional FFC domain parameter values for seed, pcounter and gindex may need to be stored\nfor validation purposes.  For DH the seed and pcounter can be stored in ASN1 data (but the\ngindex is not). For DSA however, these fields are not stored in the ASN1 data so they need to\nbe stored externally if validation is required.\n\nThe DH key type uses PKCS#3 format which saves p and g, but not the 'q' value.  The DHX key\ntype uses X9.42 format which saves the value of 'q' and this must be used for FIPS186-4.\n\n#### FFC parameters\n\nIn addition to the common parameters that all keytypes should support (see \"Common\nparameters\" in provider-keymgmt(7)), the DSA, DH and DHX keytype implementations support the\nfollowing.\n\n\"pub\" (OSSLPKEYPARAMPUBKEY) <unsigned integer>\nThe public key value.\n\n\"priv\" (OSSLPKEYPARAMPRIVKEY) <unsigned integer>\nThe private key value.\n\n#### FFC DSA, DH and DHX domain parameters\n\n\"p\" (OSSLPKEYPARAMFFCP) <unsigned integer>\nA DSA or Diffie-Hellman prime \"p\" value.\n\n\"g\" (OSSLPKEYPARAMFFCG) <unsigned integer>\nA DSA or Diffie-Hellman generator \"g\" value.\n\n#### FFC DSA and DHX domain parameters\n\n\"q\" (OSSLPKEYPARAMFFCQ) <unsigned integer>\nA DSA or Diffie-Hellman prime \"q\" value.\n\n\"seed\" (OSSLPKEYPARAMFFCSEED) <octet string>\nAn optional domain parameter seed value used during generation and validation of p, q and\ncanonical g.  For validation this needs to set the seed that was produced during\ngeneration.\n\n\"gindex\" (OSSLPKEYPARAMFFCGINDEX) <integer>\nSets the index to use for canonical generation and verification of the generator g.  Set\nthis to a positive value from 0..FF to use this mode. This gindex can then be reused\nduring key validation to verify the value of g. If this value is not set or is -1 then\nunverifiable generation of the generator g will be used.\n\n\"pcounter\" (OSSLPKEYPARAMFFCPCOUNTER) <integer>\nAn optional domain parameter counter value that is output during generation of p. This\nvalue must be saved if domain parameter validation is required.\n\n\"hindex\" (OSSLPKEYPARAMFFCH) <integer>\nFor unverifiable generation of the generator g this value is output during generation of\ng. Its value is the first integer larger than one that satisfies g = h^j mod p (where g\n!= 1 and \"j\" is the cofactor).\n\n\"j\" (OSSLPKEYPARAMFFCCOFACTOR) <unsigned integer>\nAn optional informational cofactor parameter that should equal to (p - 1) / q.\n\n\"validate-pq\" (OSSLPKEYPARAMFFCVALIDATEPQ) <unsigned integer>\n\"validate-g\" (OSSLPKEYPARAMFFCVALIDATEG) <unsigned integer>\nThese boolean values are used during FIPS186-4 or FIPS186-2 key validation checks (See\nEVPPKEYparamcheck(3)) to select validation options. By default validate-pq and\nvalidate-g are both set to 1 to check that p,q and g are valid. Either of these may be\nset to 0 to skip a test, which is mainly useful for testing purposes.\n\n\"validate-legacy\" (OSSLPKEYPARAMFFCVALIDATELEGACY) <unsigned integer>\nThis boolean value is used during key validation checks (See EVPPKEYparamcheck(3)) to\nselect the validation type. The default value of 0 selects FIPS186-4 validation. Setting\nthis value to 1 selects FIPS186-2 validation.\n\n#### FFC key generation parameters\n\nThe following key generation types are available for DSA and DHX algorithms:\n\n\"type\" (OSSLPKEYPARAMFFCTYPE) <UTF8 string>\nSets the type of parameter generation. The shared valid values are:\n\n\"fips1864\"\nThe current standard.\n\n\"fips1862\"\nThe old standard that should only be used for legacy purposes.\n\n\"default\"\nThis can choose one of \"fips1864\" or \"fips1862\" depending on other parameters set\nfor parameter generation.\n\n\"pbits\" (OSSLPKEYPARAMFFCPBITS) <unsigned integer>\nSets the size (in bits) of the prime 'p'.\n\n\"qbits\" (OSSLPKEYPARAMFFCQBITS) <unsigned integer>\nSets the size (in bits) of the prime 'q'.\n\nFor \"fips1864\" this can be either 224 or 256.  For \"fips1862\" this has a size of 160.\n\n\"digest\" (OSSLPKEYPARAMFFCDIGEST)  <UTF8 string>\nSets the Digest algorithm to be used as part of the Key Generation Function associated\nwith the given Key Generation ctx.  This must also be set for key validation.\n\n\"properties\" (OSSLPKEYPARAMFFCDIGESTPROPS) <UTF8 string>\nSets properties to be used upon look up of the implementation for the selected Digest\nalgorithm for the Key Generation Function associated with the given key generation ctx.\nThis may also be set for key validation.\n\n\"seed\" (OSSLPKEYPARAMFFCSEED) <octet string>\nFor \"fips1864\" or \"fips1862\" generation this sets the seed data to use instead of\ngenerating a random seed internally. This should be used for testing purposes only. This\nwill either produce fixed values for the generated parameters OR it will fail if the seed\ndid not generate valid primes.\n\n\"gindex\" (OSSLPKEYPARAMFFCGINDEX) <integer>\n\"pcounter\" (OSSLPKEYPARAMFFCPCOUNTER) <integer>\n\"hindex\" (OSSLPKEYPARAMFFCH) <integer>\nThese types are described above.\n\n### CONFORMING TO\n\nThe following sections of SP800-56Ar3:\n\n5.5.1.1 FFC Domain Parameter Selection/Generation\n\nThe following sections of FIPS 186-4:\n\nA.1.1.2 Generation of Probable Primes p and q Using an Approved Hash Function.\nA.2.3 Generation of canonical generator g.\nA.2.1 Unverifiable Generation of the Generator g.\n\n### SEE ALSO\n\nEVPPKEY-DSA(7), EVPPKEY-DH(7), EVPSIGNATURE-DSA(7), EVPKEYEXCH-DH(7) EVPKEYMGMT(3),\nEVPPKEY(3), provider-keymgmt(7), OSSLPROVIDER-default(7), OSSLPROVIDER-FIPS(7),\n\n### COPYRIGHT\n\nCopyright 2020-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-04-07                           EVPPKEY-FFC(7SSL)\n\n"
        }
    ],
    "structuredContent": {
        "command": "EVP_PKEY-FFC",
        "section": "7ssl",
        "mode": "man",
        "summary": "EVPPKEY-FFC - EVPPKEY DSA and DH/DHX shared FFC parameters.",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [
            {
                "name": "EVPPKEY-DSA",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/EVPPKEY-DSA/7/json"
            },
            {
                "name": "EVPPKEY-DH",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/EVPPKEY-DH/7/json"
            },
            {
                "name": "EVPSIGNATURE-DSA",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/EVPSIGNATURE-DSA/7/json"
            },
            {
                "name": "EVPKEYEXCH-DH",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/EVPKEYEXCH-DH/7/json"
            },
            {
                "name": "EVPKEYMGMT",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/EVPKEYMGMT/3/json"
            },
            {
                "name": "EVPPKEY",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/EVPPKEY/3/json"
            },
            {
                "name": "provider-keymgmt",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/provider-keymgmt/7/json"
            },
            {
                "name": "OSSLPROVIDER-default",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/OSSLPROVIDER-default/7/json"
            },
            {
                "name": "OSSLPROVIDER-FIPS",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/OSSLPROVIDER-FIPS/7/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 18,
                "subsections": [
                    {
                        "name": "FFC parameters",
                        "lines": 10
                    },
                    {
                        "name": "FFC DSA, DH and DHX domain parameters",
                        "lines": 6
                    },
                    {
                        "name": "FFC DSA and DHX domain parameters",
                        "lines": 38
                    },
                    {
                        "name": "FFC key generation parameters",
                        "lines": 43
                    }
                ]
            },
            {
                "name": "CONFORMING TO",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 9,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "EVPPKEY-FFC - EVPPKEY DSA and DH/DHX shared FFC parameters.\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Finite field cryptography (FFC) is a method of implementing discrete logarithm cryptography\nusing finite field mathematics. DSA is an example of FFC and Diffie-Hellman key establishment\nalgorithms specified in SP800-56A can also be implemented as FFC.\n\nThe DSA, DH and DHX keytypes are implemented in OpenSSL's default and FIPS providers.  The\nimplementations support the basic DSA, DH and DHX keys, containing the public and private\nkeys pub and priv as well as the three main domain parameters p, q and g.\n\nFor DSA (and DH that is not a named group) the FIPS186-4 standard specifies that the values\nused for FFC parameter generation are also required for parameter validation.  This means\nthat optional FFC domain parameter values for seed, pcounter and gindex may need to be stored\nfor validation purposes.  For DH the seed and pcounter can be stored in ASN1 data (but the\ngindex is not). For DSA however, these fields are not stored in the ASN1 data so they need to\nbe stored externally if validation is required.\n\nThe DH key type uses PKCS#3 format which saves p and g, but not the 'q' value.  The DHX key\ntype uses X9.42 format which saves the value of 'q' and this must be used for FIPS186-4.\n",
                "subsections": [
                    {
                        "name": "FFC parameters",
                        "content": "In addition to the common parameters that all keytypes should support (see \"Common\nparameters\" in provider-keymgmt(7)), the DSA, DH and DHX keytype implementations support the\nfollowing.\n\n\"pub\" (OSSLPKEYPARAMPUBKEY) <unsigned integer>\nThe public key value.\n\n\"priv\" (OSSLPKEYPARAMPRIVKEY) <unsigned integer>\nThe private key value.\n"
                    },
                    {
                        "name": "FFC DSA, DH and DHX domain parameters",
                        "content": "\"p\" (OSSLPKEYPARAMFFCP) <unsigned integer>\nA DSA or Diffie-Hellman prime \"p\" value.\n\n\"g\" (OSSLPKEYPARAMFFCG) <unsigned integer>\nA DSA or Diffie-Hellman generator \"g\" value.\n"
                    },
                    {
                        "name": "FFC DSA and DHX domain parameters",
                        "content": "\"q\" (OSSLPKEYPARAMFFCQ) <unsigned integer>\nA DSA or Diffie-Hellman prime \"q\" value.\n\n\"seed\" (OSSLPKEYPARAMFFCSEED) <octet string>\nAn optional domain parameter seed value used during generation and validation of p, q and\ncanonical g.  For validation this needs to set the seed that was produced during\ngeneration.\n\n\"gindex\" (OSSLPKEYPARAMFFCGINDEX) <integer>\nSets the index to use for canonical generation and verification of the generator g.  Set\nthis to a positive value from 0..FF to use this mode. This gindex can then be reused\nduring key validation to verify the value of g. If this value is not set or is -1 then\nunverifiable generation of the generator g will be used.\n\n\"pcounter\" (OSSLPKEYPARAMFFCPCOUNTER) <integer>\nAn optional domain parameter counter value that is output during generation of p. This\nvalue must be saved if domain parameter validation is required.\n\n\"hindex\" (OSSLPKEYPARAMFFCH) <integer>\nFor unverifiable generation of the generator g this value is output during generation of\ng. Its value is the first integer larger than one that satisfies g = h^j mod p (where g\n!= 1 and \"j\" is the cofactor).\n\n\"j\" (OSSLPKEYPARAMFFCCOFACTOR) <unsigned integer>\nAn optional informational cofactor parameter that should equal to (p - 1) / q.\n\n\"validate-pq\" (OSSLPKEYPARAMFFCVALIDATEPQ) <unsigned integer>\n\"validate-g\" (OSSLPKEYPARAMFFCVALIDATEG) <unsigned integer>\nThese boolean values are used during FIPS186-4 or FIPS186-2 key validation checks (See\nEVPPKEYparamcheck(3)) to select validation options. By default validate-pq and\nvalidate-g are both set to 1 to check that p,q and g are valid. Either of these may be\nset to 0 to skip a test, which is mainly useful for testing purposes.\n\n\"validate-legacy\" (OSSLPKEYPARAMFFCVALIDATELEGACY) <unsigned integer>\nThis boolean value is used during key validation checks (See EVPPKEYparamcheck(3)) to\nselect the validation type. The default value of 0 selects FIPS186-4 validation. Setting\nthis value to 1 selects FIPS186-2 validation.\n"
                    },
                    {
                        "name": "FFC key generation parameters",
                        "content": "The following key generation types are available for DSA and DHX algorithms:\n\n\"type\" (OSSLPKEYPARAMFFCTYPE) <UTF8 string>\nSets the type of parameter generation. The shared valid values are:\n\n\"fips1864\"\nThe current standard.\n\n\"fips1862\"\nThe old standard that should only be used for legacy purposes.\n\n\"default\"\nThis can choose one of \"fips1864\" or \"fips1862\" depending on other parameters set\nfor parameter generation.\n\n\"pbits\" (OSSLPKEYPARAMFFCPBITS) <unsigned integer>\nSets the size (in bits) of the prime 'p'.\n\n\"qbits\" (OSSLPKEYPARAMFFCQBITS) <unsigned integer>\nSets the size (in bits) of the prime 'q'.\n\nFor \"fips1864\" this can be either 224 or 256.  For \"fips1862\" this has a size of 160.\n\n\"digest\" (OSSLPKEYPARAMFFCDIGEST)  <UTF8 string>\nSets the Digest algorithm to be used as part of the Key Generation Function associated\nwith the given Key Generation ctx.  This must also be set for key validation.\n\n\"properties\" (OSSLPKEYPARAMFFCDIGESTPROPS) <UTF8 string>\nSets properties to be used upon look up of the implementation for the selected Digest\nalgorithm for the Key Generation Function associated with the given key generation ctx.\nThis may also be set for key validation.\n\n\"seed\" (OSSLPKEYPARAMFFCSEED) <octet string>\nFor \"fips1864\" or \"fips1862\" generation this sets the seed data to use instead of\ngenerating a random seed internally. This should be used for testing purposes only. This\nwill either produce fixed values for the generated parameters OR it will fail if the seed\ndid not generate valid primes.\n\n\"gindex\" (OSSLPKEYPARAMFFCGINDEX) <integer>\n\"pcounter\" (OSSLPKEYPARAMFFCPCOUNTER) <integer>\n\"hindex\" (OSSLPKEYPARAMFFCH) <integer>\nThese types are described above.\n"
                    }
                ]
            },
            "CONFORMING TO": {
                "content": "The following sections of SP800-56Ar3:\n\n5.5.1.1 FFC Domain Parameter Selection/Generation\n\nThe following sections of FIPS 186-4:\n\nA.1.1.2 Generation of Probable Primes p and q Using an Approved Hash Function.\nA.2.3 Generation of canonical generator g.\nA.2.1 Unverifiable Generation of the Generator g.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "EVPPKEY-DSA(7), EVPPKEY-DH(7), EVPSIGNATURE-DSA(7), EVPKEYEXCH-DH(7) EVPKEYMGMT(3),\nEVPPKEY(3), provider-keymgmt(7), OSSLPROVIDER-default(7), OSSLPROVIDER-FIPS(7),\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright 2020-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-04-07                           EVPPKEY-FFC(7SSL)",
                "subsections": []
            }
        }
    }
}