Search:

X25519(3) DragonFly Library Functions Manual X25519(3)## NAME

X25519,X25519_keypair- Elliptic Curve Diffie-Hellman primitive based on Curve25519## SYNOPSIS

#include<openssl/curve25519.h>intX25519(uint8_tout_shared_key[X25519_KEY_LENGTH],constuint8_tprivate_key[X25519_KEY_LENGTH],constuint8_tpeer_public_value[X25519_KEY_LENGTH]);voidX25519_keypair(uint8_tout_public_value[X25519_KEY_LENGTH],uint8_tout_private_key[X25519_KEY_LENGTH]);## DESCRIPTION

Curve25519 is an elliptic curve over a prime field specified in RFC 7748. The prime field is defined by the prime number 2^255 - 19.X25519() is the Diffie-Hellman primitive built from Curve25519 as described in RFC 7748 section 5. Section 6.1 describes the intended use in an Elliptic Curve Diffie-Hellman (ECDH) protocol.X25519() writes a shared key toout_shared_keythat is calculated from the givenprivate_keyand thepeer_public_valueby scalar multiplication. Do not use the shared key directly, rather use a key derivation function and also include the two public values as inputs.X25519_keypair() setsout_public_valueandout_private_keyto a freshly generated public/private key pair. First, theout_private_keyis generated with arc4random_buf(3). Then, the opposite of the masking described in RFC 7748 section 5 is applied to it to make sure that the generated private key is never correctly masked. The purpose is to cause incorrect implementations on the peer side to consistently fail. Correct implementations will decode the key correctly even when it is not correctly masked. Finally, theout_public_valueis calculated from theout_private_keyby multiplying it with the Montgomery base pointuint8_tu[32]= {9}. The size of a public and private key is X25519_KEY_LENGTH = 32 bytes each.## RETURN VALUES

X25519() returns 1 on success or 0 on error. Failure can occur when the input is a point of small order.## SEE ALSO

ECDH_compute_key(3) D. J. Bernstein, A state-of-the-art Diffie-Hellman function: How do I use Curve25519 in my own software?, http://cr.yp.to/ecdh.html.## STANDARDS

RFC 7748: Elliptic Curves for Security DragonFly 5.9-DEVELOPMENT August 19, 2019 DragonFly 5.9-DEVELOPMENT X25519(3) DragonFly Library Functions Manual X25519(3)## NAME

X25519,X25519_keypair- Elliptic Curve Diffie-Hellman primitive based on Curve25519## SYNOPSIS

#include<openssl/curve25519.h>intX25519(uint8_tout_shared_key[X25519_KEY_LENGTH],constuint8_tprivate_key[X25519_KEY_LENGTH],constuint8_tpeer_public_value[X25519_KEY_LENGTH]);voidX25519_keypair(uint8_tout_public_value[X25519_KEY_LENGTH],uint8_tout_private_key[X25519_KEY_LENGTH]);## DESCRIPTION

Curve25519 is an elliptic curve over a prime field specified in RFC 7748. The prime field is defined by the prime number 2^255 - 19.X25519() is the Diffie-Hellman primitive built from Curve25519 as described in RFC 7748 section 5. Section 6.1 describes the intended use in an Elliptic Curve Diffie-Hellman (ECDH) protocol.X25519() writes a shared key toout_shared_keythat is calculated from the givenprivate_keyand thepeer_public_valueby scalar multiplication. Do not use the shared key directly, rather use a key derivation function and also include the two public values as inputs.X25519_keypair() setsout_public_valueandout_private_keyto a freshly generated public/private key pair. First, theout_private_keyis generated with arc4random_buf(3). Then, the opposite of the masking described in RFC 7748 section 5 is applied to it to make sure that the generated private key is never correctly masked. The purpose is to cause incorrect implementations on the peer side to consistently fail. Correct implementations will decode the key correctly even when it is not correctly masked. Finally, theout_public_valueis calculated from theout_private_keyby multiplying it with the Montgomery base pointuint8_tu[32]= {9}. The size of a public and private key is X25519_KEY_LENGTH = 32 bytes each.## RETURN VALUES

X25519() returns 1 on success or 0 on error. Failure can occur when the input is a point of small order.## SEE ALSO

ECDH_compute_key(3) D. J. Bernstein, A state-of-the-art Diffie-Hellman function: How do I use Curve25519 in my own software?, http://cr.yp.to/ecdh.html.## STANDARDS

RFC 7748: Elliptic Curves for Security DragonFly 5.9-DEVELOPMENT August 19, 2019 DragonFly 5.9-DEVELOPMENT

Search: