EVP_PKEY-X25519.pod 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. =head2 Keygen Parameters
  12. =over 4
  13. =item "dhkem-ikm" (B<OSSL_PKEY_PARAM_DHKEM_IKM>) <octet string>
  14. DHKEM requires the generation of a keypair using an input key material (seed).
  15. Use this to specify the key material used for generation of the private key.
  16. This value should not be reused for other purposes.
  17. It should have a length of at least 32 for X25519, and 56 for X448.
  18. This is only supported by X25519 and X448.
  19. =back
  20. Use EVP_PKEY_CTX_set_params() after calling EVP_PKEY_keygen_init().
  21. =head2 Common X25519, X448, ED25519 and ED448 parameters
  22. In addition to the common parameters that all keytypes should support (see
  23. L<provider-keymgmt(7)/Common parameters>), the implementation of these keytypes
  24. support the following.
  25. =over 4
  26. =item "group" (B<OSSL_PKEY_PARAM_GROUP_NAME>) <UTF8 string>
  27. This is only supported by X25519 and X448. The group name must be "x25519" or
  28. "x448" respectively for those algorithms. This is only present for consistency
  29. with other key exchange algorithms and is typically not needed.
  30. =item "pub" (B<OSSL_PKEY_PARAM_PUB_KEY>) <octet string>
  31. The public key value.
  32. =item "priv" (B<OSSL_PKEY_PARAM_PRIV_KEY>) <octet string>
  33. The private key value.
  34. =item "encoded-pub-key" (B<OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY>) <octet string>
  35. Used for getting and setting the encoding of a public key for the B<X25519> and
  36. B<X448> key types. Public keys are expected be encoded in a format as defined by
  37. RFC7748.
  38. =back
  39. =head2 ED25519 and ED448 parameters
  40. =over 4
  41. =item "mandatory-digest" (B<OSSL_PKEY_PARAM_MANDATORY_DIGEST>) <UTF8 string>
  42. The empty string, signifying that no digest may be specified.
  43. =back
  44. =head1 CONFORMING TO
  45. =over 4
  46. =item RFC 8032
  47. =item RFC 8410
  48. =back
  49. =head1 EXAMPLES
  50. An B<EVP_PKEY> context can be obtained by calling:
  51. EVP_PKEY_CTX *pctx =
  52. EVP_PKEY_CTX_new_from_name(NULL, "X25519", NULL);
  53. EVP_PKEY_CTX *pctx =
  54. EVP_PKEY_CTX_new_from_name(NULL, "X448", NULL);
  55. EVP_PKEY_CTX *pctx =
  56. EVP_PKEY_CTX_new_from_name(NULL, "ED25519", NULL);
  57. EVP_PKEY_CTX *pctx =
  58. EVP_PKEY_CTX_new_from_name(NULL, "ED448", NULL);
  59. An B<X25519> key can be generated like this:
  60. pkey = EVP_PKEY_Q_keygen(NULL, NULL, "X25519");
  61. An B<X448>, B<ED25519>, or B<ED448> key can be generated likewise.
  62. =head1 SEE ALSO
  63. L<EVP_KEYMGMT(3)>, L<EVP_PKEY(3)>, L<provider-keymgmt(7)>,
  64. L<EVP_KEYEXCH-X25519(7)>, L<EVP_KEYEXCH-X448(7)>,
  65. L<EVP_SIGNATURE-ED25519(7)>, L<EVP_SIGNATURE-ED448(7)>
  66. =head1 COPYRIGHT
  67. Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
  68. Licensed under the Apache License 2.0 (the "License"). You may not use
  69. this file except in compliance with the License. You can obtain a copy
  70. in the file LICENSE in the source distribution or at
  71. L<https://www.openssl.org/source/license.html>.
  72. =cut