EVP_PKEY-X25519.pod 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. =pod
  2. =head1 NAME
  3. EVP_PKEY-X25519, EVP_PKEY-X448, EVP_PKEY-ED25519, EVP_PKEY-ED448,
  4. EVP_KEYMGMT-X25519, EVP_KEYMGMT-X448, EVP_KEYMGMT-ED25519, EVP_KEYMGMT-ED448
  5. - EVP_PKEY X25519, X448, ED25519 and ED448 keytype and algorithm support
  6. =head1 DESCRIPTION
  7. The B<X25519>, B<X448>, B<ED25519> and B<ED448> keytypes are
  8. implemented in OpenSSL's default and FIPS providers. These implementations
  9. support the associated key, containing the public key I<pub> and the
  10. private key I<priv>.
  11. In the FIPS provider they are non-approved algorithms and do not have the
  12. "fips=yes" property set.
  13. No additional parameters can be set during key generation.
  14. =head2 Common X25519, X448, ED25519 and ED448 parameters
  15. In addition to the common parameters that all keytypes should support (see
  16. L<provider-keymgmt(7)/Common parameters>), the implementation of these keytypes
  17. support the following.
  18. =over 4
  19. =item "group" (B<OSSL_PKEY_PARAM_GROUP_NAME>) <UTF8 string>
  20. This is only supported by X25519 and X448. The group name must be "x25519" or
  21. "x448" respectively for those algorithms. This is only present for consistency
  22. with other key exchange algorithms and is typically not needed.
  23. =item "pub" (B<OSSL_PKEY_PARAM_PUB_KEY>) <octet string>
  24. The public key value.
  25. =item "priv" (B<OSSL_PKEY_PARAM_PRIV_KEY>) <octet string>
  26. The private key value.
  27. =item "encoded-pub-key" (B<OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY>) <octet string>
  28. Used for getting and setting the encoding of a public key for the B<X25519> and
  29. B<X448> key types. Public keys are expected be encoded in a format as defined by
  30. RFC7748.
  31. =back
  32. =head2 ED25519 and ED448 parameters
  33. =over 4
  34. =item "mandatory-digest" (B<OSSL_PKEY_PARAM_MANDATORY_DIGEST>) <utf8 string>
  35. The empty string, signifying that no digest may be specified.
  36. =back
  37. =head1 CONFORMING TO
  38. =over 4
  39. =item RFC 8032
  40. =item RFC 8410
  41. =back
  42. =head1 EXAMPLES
  43. An B<EVP_PKEY> context can be obtained by calling:
  44. EVP_PKEY_CTX *pctx =
  45. EVP_PKEY_CTX_new_from_name(NULL, "X25519", NULL);
  46. EVP_PKEY_CTX *pctx =
  47. EVP_PKEY_CTX_new_from_name(NULL, "X448", NULL);
  48. EVP_PKEY_CTX *pctx =
  49. EVP_PKEY_CTX_new_from_name(NULL, "ED25519", NULL);
  50. EVP_PKEY_CTX *pctx =
  51. EVP_PKEY_CTX_new_from_name(NULL, "ED448", NULL);
  52. An B<ED25519> key can be generated like this:
  53. EVP_PKEY *pkey = NULL;
  54. EVP_PKEY_CTX *pctx =
  55. EVP_PKEY_CTX_new_from_name(NULL, "ED25519", NULL);
  56. EVP_PKEY_keygen_init(pctx);
  57. EVP_PKEY_gen(pctx, &pkey);
  58. EVP_PKEY_CTX_free(pctx);
  59. An B<X25519> key can be generated in a similar way:
  60. EVP_PKEY *pkey = NULL;
  61. EVP_PKEY_CTX *pctx =
  62. EVP_PKEY_CTX_new_from_name(NULL, "X25519", NULL);
  63. EVP_PKEY_keygen_init(pctx);
  64. EVP_PKEY_gen(pctx, &pkey);
  65. EVP_PKEY_CTX_free(pctx);
  66. =head1 SEE ALSO
  67. L<EVP_KEYMGMT(3)>, L<EVP_PKEY(3)>, L<provider-keymgmt(7)>,
  68. L<EVP_KEYEXCH-X25519(7)>, L<EVP_KEYEXCH-X448(7)>,
  69. L<EVP_SIGNATURE-ED25519(7)>, L<EVP_SIGNATURE-ED448(7)>
  70. =head1 COPYRIGHT
  71. Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
  72. Licensed under the Apache License 2.0 (the "License"). You may not use
  73. this file except in compliance with the License. You can obtain a copy
  74. in the file LICENSE in the source distribution or at
  75. L<https://www.openssl.org/source/license.html>.
  76. =cut