Contains the primary public API for the Edwards Elliptic Curve Diffie-Hellman key exchange. More...
#include "qsccommon.h"Go to the source code of this file.
Functions | |
| QSC_EXPORT_API void | qsc_eddh_public_from_private (uint8_t *publickey, const uint8_t *privatekey) |
| Derives an X25519 public key from an existing private key. | |
| QSC_EXPORT_API bool | qsc_eddh_generate_keypair (uint8_t *publickey, uint8_t *privatekey, bool(*rng_generate)(uint8_t *, size_t)) |
| Generates public and private keys for the EDDH key encapsulation mechanism. | |
| QSC_EXPORT_API bool | qsc_eddh_generate_seeded_keypair (uint8_t *publickey, uint8_t *privatekey, const uint8_t *seed) |
| Generates public and private keys for the EDDH key encapsulation mechanism using a seed. | |
| QSC_EXPORT_API bool | qsc_eddh_key_exchange (uint8_t *secret, const uint8_t *privatekey, const uint8_t *publickey) |
| Decapsulates the shared secret for a given cipher-text using a private-key. | |
Contains the primary public API for the Edwards Elliptic Curve Diffie-Hellman key exchange.
This header defines the API for the EDDH key encapsulation mechanism using the Curve25519/Ed25519 elliptic curve. It provides functions for generating key pairs (either randomly or seeded) and for performing the key exchange operation (decapsulation) to derive a shared secret.
The implementation is based on established protocols for elliptic curve cryptography and leverages the underlying field arithmetic and curve operations of the Ed25519 signature scheme. It is designed for secure key encapsulation in cryptographic protocols and has been optimized for performance and constant-time execution to mitigate side-channel attacks.
| QSC_EXPORT_API bool qsc_eddh_generate_keypair | ( | uint8_t * | publickey, |
| uint8_t * | privatekey, | ||
| bool(* | rng_generate )(uint8_t *, size_t) ) |
Generates public and private keys for the EDDH key encapsulation mechanism.
| publickey | [uint8_t*] Pointer to the output public-key array. |
| privatekey | [uint8_t*] Pointer to the output private-key array. |
| rng_generate | [bool (*)(uint8_t*, size_t)] Pointer to the random generator function. |
| QSC_EXPORT_API bool qsc_eddh_generate_seeded_keypair | ( | uint8_t * | publickey, |
| uint8_t * | privatekey, | ||
| const uint8_t * | seed ) |
Generates public and private keys for the EDDH key encapsulation mechanism using a seed.
| publickey | [uint8_t*] Pointer to the output public-key array. |
| privatekey | [uint8_t*] Pointer to the output private-key array. |
| seed | [const uint8_t*] Pointer to the random seed. |
| QSC_EXPORT_API bool qsc_eddh_key_exchange | ( | uint8_t * | secret, |
| const uint8_t * | privatekey, | ||
| const uint8_t * | publickey ) |
Decapsulates the shared secret for a given cipher-text using a private-key.
| secret | [uint8_t*] Pointer to the shared secret key array. |
| privatekey | [const uint8_t*] Pointer to the private-key array. |
| publickey | [const uint8_t*] Pointer to the public-key array. |
| QSC_EXPORT_API void qsc_eddh_public_from_private | ( | uint8_t * | publickey, |
| const uint8_t * | privatekey ) |
Derives an X25519 public key from an existing private key.
The private key is interpreted as 32 raw bytes. Scalar clamping is applied internally during public key derivation, as specified by RFC 7748.
This function is intended for use when importing or reconstructing keys from external representations such as PKCS#8 or application-defined storage.
| publickey | [uint8_t*] Pointer to the output public-key array. |
| privatekey:[const | uint8_t*] Pointer to the input private-key array. |