Elliptic Curve Diffie-Hellman over the NIST P-384 domain. More...
#include "qsccommon.h"Go to the source code of this file.
Functions | |
| QSC_EXPORT_API void | qsc_p384_public_from_private (uint8_t *publickey, const uint8_t *privatekey) |
| Derive a serialized P-384 public key from a private key. | |
| QSC_EXPORT_API void | qsc_p384_generate_keypair (uint8_t *publickey, uint8_t *privatekey, bool(*rng_generate)(uint8_t *, size_t)) |
| Generate a random P-384 public and private key-pair. | |
| QSC_EXPORT_API void | qsc_p384_generate_seeded_keypair (uint8_t *publickey, uint8_t *privatekey, const uint8_t *seed) |
| Generate a deterministic P-384 public and private key-pair from a seed. | |
| QSC_EXPORT_API bool | qsc_p384_key_exchange (uint8_t *secret, const uint8_t *publickey, const uint8_t *privatekey) |
| Derive a P-384 shared secret using a peer public key and a local private key. | |
Elliptic Curve Diffie-Hellman over the NIST P-384 domain.
This header exposes the low-level public interface for the QSC P-384 Elliptic Curve Diffie-Hellman implementation. The functions in this module provide private to public key derivation, random or seed-based key-pair generation, and shared secret derivation using a peer public key and a local private key.
The public key is encoded as a fixed-size byte array of QSC_ECDHP384_PUBLICKEY_SIZE bytes. The private key, shared secret, and deterministic seed are each encoded as fixed-size byte arrays of their respective constant sizes.
This interface is intended for base ECDH key establishment operations. Callers are responsible for providing correctly sized buffers and, where applicable, a cryptographically secure random generator callback.
Example:
| QSC_EXPORT_API void qsc_p384_generate_keypair | ( | uint8_t * | publickey, |
| uint8_t * | privatekey, | ||
| bool(* | rng_generate )(uint8_t *, size_t) ) |
Generate a random P-384 public and private key-pair.
| publickey | [uint8_t*] The output buffer that receives the serialized public key; must be at least QSC_ECDHP384_PUBLICKEY_SIZE bytes. |
| privatekey | [uint8_t*] The output buffer that receives the private key; must be at least QSC_ECDHP384_PRIVATEKEY_SIZE bytes. |
| rng_generate | [bool (*)(uint8_t*, size_t)] A pointer to a cryptographically secure random generator function that fills a buffer with random bytes and returns true on success. |
| QSC_EXPORT_API void qsc_p384_generate_seeded_keypair | ( | uint8_t * | publickey, |
| uint8_t * | privatekey, | ||
| const uint8_t * | seed ) |
Generate a deterministic P-384 public and private key-pair from a seed.
| publickey | [uint8_t*] The output buffer that receives the serialized public key; must be at least QSC_ECDHP384_PUBLICKEY_SIZE bytes. |
| privatekey | [uint8_t*] The output buffer that receives the private key; must be at least QSC_ECDHP384_PRIVATEKEY_SIZE bytes. |
| seed | [const uint8_t*] The input seed buffer; must contain QSC_ECDHP384_SEED_SIZE bytes. |
| QSC_EXPORT_API bool qsc_p384_key_exchange | ( | uint8_t * | secret, |
| const uint8_t * | publickey, | ||
| const uint8_t * | privatekey ) |
Derive a P-384 shared secret using a peer public key and a local private key.
| secret | [uint8_t*] The output buffer that receives the shared secret; must be at least QSC_ECDHP384_SHAREDSECRET_SIZE bytes. |
| publickey | [const uint8_t*] The peer serialized public key; must contain QSC_ECDHP384_PUBLICKEY_SIZE bytes. |
| privatekey | [const uint8_t*] The local private key; must contain QSC_ECDHP384_PRIVATEKEY_SIZE bytes. |
| QSC_EXPORT_API void qsc_p384_public_from_private | ( | uint8_t * | publickey, |
| const uint8_t * | privatekey ) |
Derive a serialized P-384 public key from a private key.
| publickey | [uint8_t*] The output buffer that receives the serialized public key; must be at least QSC_ECDHP384_PUBLICKEY_SIZE bytes. |
| privatekey | [const uint8_t*] The input private key buffer; must contain QSC_ECDHP384_PRIVATEKEY_SIZE bytes. |