
Functions | |
| WOLFSSL_API int | wc_curve25519_make_key (WC_RNG *rng, int keysize, curve25519_key *key) |
| This function generates a curve25519 key using the given random number generator, rng, of the size given (keysize), and stores it in the given curve25519_key structure. It should be called after the key structure has been initialized through wc_curve25519_init. More... | |
| WOLFSSL_API int | wc_curve25519_shared_secret (curve25519_key *private_key, curve25519_key *public_key, byte *out, word32 *outlen) |
| This function computes a shared secret key given a secret private key and a received public key. It stores the generated secret key in the buffer out and assigns the variable of the secret key to outlen. Only supports big endian. More... | |
| WOLFSSL_API int | wc_curve25519_shared_secret_ex (curve25519_key *private_key, curve25519_key *public_key, byte *out, word32 *outlen, int endian) |
| This function computes a shared secret key given a secret private key and a received public key. It stores the generated secret key in the buffer out and assigns the variable of the secret key to outlen. Supports both big and little endian. More... | |
| WOLFSSL_API int | wc_curve25519_init (curve25519_key *key) |
| This function initializes a curve25519 key. It should be called before generating a key for the structure with wc_curve25519_init and before using the key to encrypt data. More... | |
| WOLFSSL_API void | wc_curve25519_free (curve25519_key *key) |
| This function frees a curve 25519 object. More... | |
| WOLFSSL_API int | wc_curve25519_import_private (const byte *priv, word32 privSz, curve25519_key *key) |
| This function imports a curve25519 private key only. (Big endian). More... | |
| WOLFSSL_API int | wc_curve25519_import_private_ex (const byte *priv, word32 privSz, curve25519_key *key, int endian) |
| curve25519 private key import only. (Big or Little endian). More... | |
| WOLFSSL_API int | wc_curve25519_import_private_raw (const byte *priv, word32 privSz, const byte *pub, word32 pubSz, curve25519_key *key) |
| This function imports a public-private key pair into a curve25519_key structure. Big endian only. More... | |
| WOLFSSL_API int | wc_curve25519_import_private_raw_ex (const byte *priv, word32 privSz, const byte *pub, word32 pubSz, curve25519_key *key, int endian) |
| This function imports a public-private key pair into a curve25519_key structure. Supports both big and little endian. More... | |
| WOLFSSL_API int | wc_curve25519_export_private_raw (curve25519_key *key, byte *out, word32 *outLen) |
| This function exports a private key from a curve25519_key structure and stores it in the given out buffer. It also sets outLen to be the size of the exported key. Big Endian only. More... | |
| WOLFSSL_API int | wc_curve25519_export_private_raw_ex (curve25519_key *key, byte *out, word32 *outLen, int endian) |
| This function exports a private key from a curve25519_key structure and stores it in the given out buffer. It also sets outLen to be the size of the exported key. Can specify whether it's big or little endian. More... | |
| WOLFSSL_API int | wc_curve25519_import_public (const byte *in, word32 inLen, curve25519_key *key) |
| This function imports a public key from the given in buffer and stores it in the curve25519_key structure. More... | |
| WOLFSSL_API int | wc_curve25519_import_public_ex (const byte *in, word32 inLen, curve25519_key *key, int endian) |
| This function imports a public key from the given in buffer and stores it in the curve25519_key structure. More... | |
| WOLFSSL_API int | wc_curve25519_export_public (curve25519_key *key, byte *out, word32 *outLen) |
| This function exports a public key from the given key structure and stores the result in the out buffer. Big endian only. More... | |
| WOLFSSL_API int | wc_curve25519_export_public_ex (curve25519_key *key, byte *out, word32 *outLen, int endian) |
| This function exports a public key from the given key structure and stores the result in the out buffer. Supports both big and little endian. More... | |
| WOLFSSL_API int | wc_curve25519_export_key_raw (curve25519_key *key, byte *priv, word32 *privSz, byte *pub, word32 *pubSz) |
| Export curve25519 key pair. Big endian only. More... | |
| WOLFSSL_API int | wc_curve25519_export_key_raw_ex (curve25519_key *key, byte *priv, word32 *privSz, byte *pub, word32 *pubSz, int endian) |
| Export curve25519 key pair. Big or little endian. More... | |
| WOLFSSL_API int | wc_curve25519_size (curve25519_key *key) |
| This function returns the key size of the given key structure. More... | |
| WOLFSSL_API int wc_curve25519_export_key_raw | ( | curve25519_key * | key, |
| byte * | priv, | ||
| word32 * | privSz, | ||
| byte * | pub, | ||
| word32 * | pubSz | ||
| ) |
Export curve25519 key pair. Big endian only.
| key | Description |
| priv | Private key buffer. |
| privSz | Size of private key buffer. |
| pub | Public key buffer. |
| pubSz | Size of public key buffer. |
Example
| WOLFSSL_API int wc_curve25519_export_key_raw_ex | ( | curve25519_key * | key, |
| byte * | priv, | ||
| word32 * | privSz, | ||
| byte * | pub, | ||
| word32 * | pubSz, | ||
| int | endian | ||
| ) |
Export curve25519 key pair. Big or little endian.
| key | Description |
| priv | Private key buffer. |
| privSz | Size of private key buffer. |
| pub | Public key buffer. |
| pubSz | Size of public key buffer. |
| endian | EC25519_BIG_ENDIAN or EC25519_LITTLE_ENDIAN to set which form to use. |
Example
| WOLFSSL_API int wc_curve25519_export_private_raw | ( | curve25519_key * | key, |
| byte * | out, | ||
| word32 * | outLen | ||
| ) |
This function exports a private key from a curve25519_key structure and stores it in the given out buffer. It also sets outLen to be the size of the exported key. Big Endian only.
| key | pointer to the structure from which to export the key |
| out | pointer to the buffer in which to store the exported key |
| outLen | will store the bytes written to the output buffer |
Example
| WOLFSSL_API int wc_curve25519_export_private_raw_ex | ( | curve25519_key * | key, |
| byte * | out, | ||
| word32 * | outLen, | ||
| int | endian | ||
| ) |
This function exports a private key from a curve25519_key structure and stores it in the given out buffer. It also sets outLen to be the size of the exported key. Can specify whether it's big or little endian.
| key | pointer to the structure from which to export the key |
| out | pointer to the buffer in which to store the exported key |
| outLen | will store the bytes written to the output buffer |
| endian | EC25519_BIG_ENDIAN or EC25519_LITTLE_ENDIAN to set which form to use. |
Example
| WOLFSSL_API int wc_curve25519_export_public | ( | curve25519_key * | key, |
| byte * | out, | ||
| word32 * | outLen | ||
| ) |
This function exports a public key from the given key structure and stores the result in the out buffer. Big endian only.
| key | pointer to the curve25519_key structure in from which to export the key |
| out | pointer to the buffer in which to store the public key |
| outLen | will store the bytes written to the output buffer |
Example
| WOLFSSL_API int wc_curve25519_export_public_ex | ( | curve25519_key * | key, |
| byte * | out, | ||
| word32 * | outLen, | ||
| int | endian | ||
| ) |
This function exports a public key from the given key structure and stores the result in the out buffer. Supports both big and little endian.
| key | pointer to the curve25519_key structure in from which to export the key |
| out | pointer to the buffer in which to store the public key |
| outLen | will store the bytes written to the output buffer |
| endian | EC25519_BIG_ENDIAN or EC25519_LITTLE_ENDIAN to set which form to use. |
Example
| WOLFSSL_API void wc_curve25519_free | ( | curve25519_key * | key | ) |
This function frees a curve 25519 object.
| key | pointer to the key object to free |
Example
| WOLFSSL_API int wc_curve25519_import_private | ( | const byte * | priv, |
| word32 | privSz, | ||
| curve25519_key * | key | ||
| ) |
This function imports a curve25519 private key only. (Big endian).
| priv | Private key buffer |
| privSz | Size of private key buffer. |
| key | The curve25519_key structure to store the private key. |
Example
| WOLFSSL_API int wc_curve25519_import_private_ex | ( | const byte * | priv, |
| word32 | privSz, | ||
| curve25519_key * | key, | ||
| int | endian | ||
| ) |
curve25519 private key import only. (Big or Little endian).
| priv | Buffer for private key. |
| privSz | Size of private key buffer. |
| key | The curve25519_key structure to store the private key. |
| endian | EC25519_BIG_ENDIAN or EC25519_LITTLE_ENDIAN to set which form to use. |
Example
| WOLFSSL_API int wc_curve25519_import_private_raw | ( | const byte * | priv, |
| word32 | privSz, | ||
| const byte * | pub, | ||
| word32 | pubSz, | ||
| curve25519_key * | key | ||
| ) |
This function imports a public-private key pair into a curve25519_key structure. Big endian only.
| priv | pointer to a buffer containing the private key to import |
| privSz | length of the private key to import |
| pub | pointer to a buffer containing the public key to import |
| pubSz | length of the public key to import |
| key | pointer to the structure in which to store the imported keys |
Example
| WOLFSSL_API int wc_curve25519_import_private_raw_ex | ( | const byte * | priv, |
| word32 | privSz, | ||
| const byte * | pub, | ||
| word32 | pubSz, | ||
| curve25519_key * | key, | ||
| int | endian | ||
| ) |
This function imports a public-private key pair into a curve25519_key structure. Supports both big and little endian.
| priv | pointer to a buffer containing the private key to import |
| privSz | length of the private key to import |
| pub | pointer to a buffer containing the public key to import |
| pubSz | length of the public key to import |
| key | pointer to the structure in which to store the imported keys |
| endian | EC25519_BIG_ENDIAN or EC25519_LITTLE_ENDIAN to set which form to use. |
Example
| WOLFSSL_API int wc_curve25519_import_public | ( | const byte * | in, |
| word32 | inLen, | ||
| curve25519_key * | key | ||
| ) |
This function imports a public key from the given in buffer and stores it in the curve25519_key structure.
| in | pointer to the buffer containing the public key to import |
| inLen | length of the public key to import |
| key | pointer to the curve25519_key structure in which to store the key |
Example
| WOLFSSL_API int wc_curve25519_import_public_ex | ( | const byte * | in, |
| word32 | inLen, | ||
| curve25519_key * | key, | ||
| int | endian | ||
| ) |
This function imports a public key from the given in buffer and stores it in the curve25519_key structure.
0 Returned on successfully importing the public key into the curve25519_key structure ECC_BAD_ARG_E Returned if the inLen parameter does not match the key size of the key structure BAD_FUNC_ARG Returned if any of the input parameters are NULL.
| in | pointer to the buffer containing the public key to import |
| inLen | length of the public key to import |
| key | pointer to the curve25519_key structure in which to store the key |
| endian | EC25519_BIG_ENDIAN or EC25519_LITTLE_ENDIAN to set which form to use. |
Example
| WOLFSSL_API int wc_curve25519_init | ( | curve25519_key * | key | ) |
This function initializes a curve25519 key. It should be called before generating a key for the structure with wc_curve25519_init and before using the key to encrypt data.
| key | pointer to the curve25519_key structure to initialize |
Example
| WOLFSSL_API int wc_curve25519_make_key | ( | WC_RNG * | rng, |
| int | keysize, | ||
| curve25519_key * | key | ||
| ) |
This function generates a curve25519 key using the given random number generator, rng, of the size given (keysize), and stores it in the given curve25519_key structure. It should be called after the key structure has been initialized through wc_curve25519_init.
| rng | pointer to the RNG object used to generate the ecc key |
| keysize | size of the key to generate. Must be 32 bytes for curve25519 |
| key | pointer to the curve25519_key structure in which to store the generated key |
Example
| WOLFSSL_API int wc_curve25519_shared_secret | ( | curve25519_key * | private_key, |
| curve25519_key * | public_key, | ||
| byte * | out, | ||
| word32 * | outlen | ||
| ) |
This function computes a shared secret key given a secret private key and a received public key. It stores the generated secret key in the buffer out and assigns the variable of the secret key to outlen. Only supports big endian.
| private_key | pointer to the curve25519_key structure initialized with the user’s private key |
| public_key | pointer to the curve25519_key structure containing the received public key |
| out | pointer to a buffer in which to store the 32 byte computed secret key |
| outlen | pointer in which to store the length written to the output buffer |
Example
| WOLFSSL_API int wc_curve25519_shared_secret_ex | ( | curve25519_key * | private_key, |
| curve25519_key * | public_key, | ||
| byte * | out, | ||
| word32 * | outlen, | ||
| int | endian | ||
| ) |
This function computes a shared secret key given a secret private key and a received public key. It stores the generated secret key in the buffer out and assigns the variable of the secret key to outlen. Supports both big and little endian.
| private_key | pointer to the curve25519_key structure initialized with the user’s private key |
| public_key | pointer to the curve25519_key structure containing the received public key |
| out | pointer to a buffer in which to store the 32 byte computed secret key |
| outlen | pointer in which to store the length written to the output buffer |
| endian | EC25519_BIG_ENDIAN or EC25519_LITTLE_ENDIAN to set which form to use. |
Example
| WOLFSSL_API int wc_curve25519_size | ( | curve25519_key * | key | ) |
This function returns the key size of the given key structure.
| key | pointer to the curve25519_key structure in for which to determine the key size |
Example