2
0

EVP_PKEY-DSA.pod 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. =pod
  2. =head1 NAME
  3. EVP_PKEY-DSA, EVP_KEYMGMT-DSA - EVP_PKEY DSA keytype and algorithm support
  4. =head1 DESCRIPTION
  5. For B<DSA> the FIPS186-4 standard specifies that the values used for FFC
  6. parameter generation are also required for parameter validation.
  7. This means that optional FFC domain parameter values for I<seed>, I<pcounter>
  8. and I<gindex> may need to be stored for validation purposes. For B<DSA> these
  9. fields are not stored in the ASN1 data so they need to be stored externally if
  10. validation is required.
  11. =head2 DSA parameters
  12. The B<DSA> key type supports the FFC parameters (see
  13. L<EVP_PKEY-FFC(7)/FFC parameters>).
  14. =head2 DSA key generation parameters
  15. The B<DSA> key type supports the FFC key generation parameters (see
  16. L<EVP_PKEY-FFC(7)/FFC key generation parameters>
  17. The following restrictions apply to the "pbits" field:
  18. For "fips186_4" this must be either 2048 or 3072.
  19. For "fips186_2" this must be 1024.
  20. For "group" this can be any one of 2048, 3072, 4096, 6144 or 8192.
  21. =head1 EXAMPLES
  22. An B<EVP_PKEY> context can be obtained by calling:
  23. EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_from_name(NULL, "DSA", NULL);
  24. The B<DSA> domain parameters can be generated by calling:
  25. unsigned int pbits = 2048;
  26. unsigned int qbits = 256;
  27. int gindex = 1;
  28. OSSL_PARAM params[5];
  29. EVP_PKEY *param_key = NULL;
  30. EVP_PKEY_CTX *pctx = NULL;
  31. pctx = EVP_PKEY_CTX_new_from_name(NULL, "DSA", NULL);
  32. EVP_PKEY_paramgen_init(pctx);
  33. params[0] = OSSL_PARAM_construct_uint("pbits", &pbits);
  34. params[1] = OSSL_PARAM_construct_uint("qbits", &qbits);
  35. params[2] = OSSL_PARAM_construct_int("gindex", &gindex);
  36. params[3] = OSSL_PARAM_construct_utf8_string("digest", "SHA384", 0);
  37. params[4] = OSSL_PARAM_construct_end();
  38. EVP_PKEY_CTX_set_params(pctx, params);
  39. EVP_PKEY_generate(pctx, &param_key);
  40. EVP_PKEY_CTX_free(pctx);
  41. EVP_PKEY_print_params(bio_out, param_key, 0, NULL);
  42. A B<DSA> key can be generated using domain parameters by calling:
  43. EVP_PKEY *key = NULL;
  44. EVP_PKEY_CTX *gctx = NULL;
  45. gctx = EVP_PKEY_CTX_new_from_pkey(NULL, param_key, NULL);
  46. EVP_PKEY_keygen_init(gctx);
  47. EVP_PKEY_generate(gctx, &key);
  48. EVP_PKEY_CTX_free(gctx);
  49. EVP_PKEY_print_private(bio_out, key, 0, NULL);
  50. =head1 CONFORMING TO
  51. The following sections of FIPS 186-4:
  52. =over 4
  53. =item A.1.1.2 Generation of Probable Primes p and q Using an Approved Hash Function.
  54. =item A.2.3 Generation of canonical generator g.
  55. =item A.2.1 Unverifiable Generation of the Generator g.
  56. =back
  57. =head1 SEE ALSO
  58. L<EVP_PKEY-FFC(7)>,
  59. L<EVP_SIGNATURE-DSA(7)>
  60. L<EVP_PKEY(3)>,
  61. L<provider-keymgmt(7)>,
  62. L<EVP_KEYMGMT(3)>,
  63. L<OSSL_PROVIDER-default(7)>,
  64. L<OSSL_PROVIDER-FIPS(7)>
  65. =head1 COPYRIGHT
  66. Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
  67. Licensed under the Apache License 2.0 (the "License"). You may not use
  68. this file except in compliance with the License. You can obtain a copy
  69. in the file LICENSE in the source distribution or at
  70. L<https://www.openssl.org/source/license.html>.
  71. =cut