EVP_PKEY-DSA.7ossl 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "EVP_PKEY-DSA 7ossl"
  58. .TH EVP_PKEY-DSA 7ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. EVP_PKEY\-DSA, EVP_KEYMGMT\-DSA \- EVP_PKEY DSA keytype and algorithm support
  65. .SH DESCRIPTION
  66. .IX Header "DESCRIPTION"
  67. For \fBDSA\fR the FIPS 186\-4 standard specifies that the values used for FFC
  68. parameter generation are also required for parameter validation.
  69. This means that optional FFC domain parameter values for \fIseed\fR, \fIpcounter\fR
  70. and \fIgindex\fR may need to be stored for validation purposes. For \fBDSA\fR these
  71. fields are not stored in the ASN1 data so they need to be stored externally if
  72. validation is required.
  73. .PP
  74. As part of FIPS 140\-3 DSA is not longer FIPS approved for key generation and
  75. signature validation, but is still allowed for signature verification.
  76. .SS "DSA parameters"
  77. .IX Subsection "DSA parameters"
  78. The \fBDSA\fR key type supports the FFC parameters (see
  79. "FFC parameters" in \fBEVP_PKEY\-FFC\fR\|(7)).
  80. .PP
  81. It also supports the following parameters:
  82. .IP """sign-check"" (\fBOSSL_PKEY_PARAM_FIPS_SIGN_CHECK\fR) <integer" 4
  83. .IX Item """sign-check"" (OSSL_PKEY_PARAM_FIPS_SIGN_CHECK) <integer"
  84. .PD 0
  85. .IP """fips-indicator"" (\fBOSSL_PKEY_PARAM_FIPS_APPROVED_INDICATOR\fR) <integer>" 4
  86. .IX Item """fips-indicator"" (OSSL_PKEY_PARAM_FIPS_APPROVED_INDICATOR) <integer>"
  87. .PD
  88. See "Common Information Parameters" in \fBprovider\-keymgmt\fR\|(7) for more information.
  89. .SS "DSA key generation parameters"
  90. .IX Subsection "DSA key generation parameters"
  91. The \fBDSA\fR key type supports the FFC key generation parameters (see
  92. "FFC key generation parameters" in \fBEVP_PKEY\-FFC\fR\|(7)
  93. .PP
  94. The following restrictions apply to the "pbits" field:
  95. .PP
  96. For "fips186_4" this must be either 2048 or 3072.
  97. For "fips186_2" this must be 1024.
  98. For "group" this can be any one of 2048, 3072, 4096, 6144 or 8192.
  99. .SS "DSA key validation"
  100. .IX Subsection "DSA key validation"
  101. For DSA keys, \fBEVP_PKEY_param_check\fR\|(3) behaves in the following way:
  102. The OpenSSL FIPS provider conforms to the rules within the FIPS186\-4
  103. standard for FFC parameter validation. For backwards compatibility the OpenSSL
  104. default provider uses a much simpler check (see below) for parameter validation,
  105. unless the seed parameter is set.
  106. .PP
  107. For DSA keys, \fBEVP_PKEY_param_check_quick\fR\|(3) behaves in the following way:
  108. A simple check of L and N and partial g is performed. The default provider
  109. also supports validation of legacy "fips186_2" keys.
  110. .PP
  111. For DSA keys, \fBEVP_PKEY_public_check\fR\|(3), \fBEVP_PKEY_private_check\fR\|(3) and
  112. \&\fBEVP_PKEY_pairwise_check\fR\|(3) the OpenSSL default and FIPS providers conform to
  113. the rules within SP800\-56Ar3 for public, private and pairwise tests respectively.
  114. .SH EXAMPLES
  115. .IX Header "EXAMPLES"
  116. An \fBEVP_PKEY\fR context can be obtained by calling:
  117. .PP
  118. .Vb 1
  119. \& EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_from_name(NULL, "DSA", NULL);
  120. .Ve
  121. .PP
  122. The \fBDSA\fR domain parameters can be generated by calling:
  123. .PP
  124. .Vb 6
  125. \& unsigned int pbits = 2048;
  126. \& unsigned int qbits = 256;
  127. \& int gindex = 1;
  128. \& OSSL_PARAM params[5];
  129. \& EVP_PKEY *param_key = NULL;
  130. \& EVP_PKEY_CTX *pctx = NULL;
  131. \&
  132. \& pctx = EVP_PKEY_CTX_new_from_name(NULL, "DSA", NULL);
  133. \& EVP_PKEY_paramgen_init(pctx);
  134. \&
  135. \& params[0] = OSSL_PARAM_construct_uint("pbits", &pbits);
  136. \& params[1] = OSSL_PARAM_construct_uint("qbits", &qbits);
  137. \& params[2] = OSSL_PARAM_construct_int("gindex", &gindex);
  138. \& params[3] = OSSL_PARAM_construct_utf8_string("digest", "SHA384", 0);
  139. \& params[4] = OSSL_PARAM_construct_end();
  140. \& EVP_PKEY_CTX_set_params(pctx, params);
  141. \&
  142. \& EVP_PKEY_generate(pctx, &param_key);
  143. \& EVP_PKEY_CTX_free(pctx);
  144. \&
  145. \& EVP_PKEY_print_params(bio_out, param_key, 0, NULL);
  146. .Ve
  147. .PP
  148. A \fBDSA\fR key can be generated using domain parameters by calling:
  149. .PP
  150. .Vb 2
  151. \& EVP_PKEY *key = NULL;
  152. \& EVP_PKEY_CTX *gctx = NULL;
  153. \&
  154. \& gctx = EVP_PKEY_CTX_new_from_pkey(NULL, param_key, NULL);
  155. \& EVP_PKEY_keygen_init(gctx);
  156. \& EVP_PKEY_generate(gctx, &key);
  157. \& EVP_PKEY_CTX_free(gctx);
  158. \& EVP_PKEY_print_private(bio_out, key, 0, NULL);
  159. .Ve
  160. .SH "CONFORMING TO"
  161. .IX Header "CONFORMING TO"
  162. The following sections of FIPS186\-4:
  163. .IP "A.1.1.2 Generation of Probable Primes p and q Using an Approved Hash Function." 4
  164. .IX Item "A.1.1.2 Generation of Probable Primes p and q Using an Approved Hash Function."
  165. .PD 0
  166. .IP "A.2.3 Generation of canonical generator g." 4
  167. .IX Item "A.2.3 Generation of canonical generator g."
  168. .IP "A.2.1 Unverifiable Generation of the Generator g." 4
  169. .IX Item "A.2.1 Unverifiable Generation of the Generator g."
  170. .PD
  171. .SH "SEE ALSO"
  172. .IX Header "SEE ALSO"
  173. \&\fBEVP_PKEY\-FFC\fR\|(7),
  174. \&\fBEVP_SIGNATURE\-DSA\fR\|(7)
  175. \&\fBEVP_PKEY\fR\|(3),
  176. \&\fBprovider\-keymgmt\fR\|(7),
  177. \&\fBEVP_KEYMGMT\fR\|(3),
  178. \&\fBOSSL_PROVIDER\-default\fR\|(7),
  179. \&\fBOSSL_PROVIDER\-FIPS\fR\|(7)
  180. .SH HISTORY
  181. .IX Header "HISTORY"
  182. DSA Key generation and signature generation are no longer FIPS approved in
  183. OpenSSL 3.4. See "FIPS indicators" in \fBfips_module\fR\|(7) for more information.
  184. .SH COPYRIGHT
  185. .IX Header "COPYRIGHT"
  186. Copyright 2020\-2024 The OpenSSL Project Authors. All Rights Reserved.
  187. .PP
  188. Licensed under the Apache License 2.0 (the "License"). You may not use
  189. this file except in compliance with the License. You can obtain a copy
  190. in the file LICENSE in the source distribution or at
  191. <https://www.openssl.org/source/license.html>.