My Project
|
Functions | |
int | wc_ed25519_make_public (ed25519_key *key, unsigned char *pubKey, word32 pubKeySz) |
This function generates the Ed25519 public key from the private key, stored in the ed25519_key object. It stores the public key in the buffer pubKey. More... | |
int | wc_ed25519_make_key (WC_RNG *rng, int keysize, ed25519_key *key) |
This function generates a new Ed25519 key and stores it in key. More... | |
int | wc_ed25519_sign_msg (const byte *in, word32 inlen, byte *out, word32 *outlen, ed25519_key *key) |
This function signs a message using an ed25519_key object to guarantee authenticity. More... | |
int | wc_ed25519ctx_sign_msg (const byte *in, word32 inlen, byte *out, word32 *outlen, ed25519_key *key, const byte *context, byte contextLen) |
This function signs a message using an ed25519_key object to guarantee authenticity. The context is part of the data signed. More... | |
int | wc_ed25519ph_sign_hash (const byte *hash, word32 hashLen, byte *out, word32 *outLen, ed25519_key *key, const byte *context, byte contextLen) |
This function signs a message digest using an ed25519_key object to guarantee authenticity. The context is included as part of the data signed. The message is pre-hashed before signature calculation. More... | |
int | wc_ed25519ph_sign_msg (const byte *in, word32 inlen, byte *out, word32 *outlen, ed25519_key *key, const byte *context, byte contextLen) |
This function signs a message using an ed25519_key object to guarantee authenticity. The context is included as part of the data signed. The message is pre-hashed before signature calculation. More... | |
int | wc_ed25519_verify_msg (const byte *sig, word32 siglen, const byte *msg, word32 msgLen, int *ret, ed25519_key *key) |
This function verifies the Ed25519 signature of a message to ensure authenticity. It returns the answer through ret, with 1 corresponding to a valid signature, and 0 corresponding to an invalid signature. More... | |
int | wc_ed25519ctx_verify_msg (const byte *sig, word32 siglen, const byte *msg, word32 msgLen, int *ret, ed25519_key *key, const byte *context, byte contextLen) |
This function verifies the Ed25519 signature of a message to ensure authenticity. The context is included as part of the data verified. It returns the answer through ret, with 1 corresponding to a valid signature, and 0 corresponding to an invalid signature. More... | |
int | wc_ed25519ph_verify_hash (const byte *sig, word32 siglen, const byte *hash, word32 hashLen, int *ret, ed25519_key *key, const byte *context, byte contextLen) |
This function verifies the Ed25519 signature of the digest of a message to ensure authenticity. The context is included as part of the data verified. The hash is the pre-hashed message before signature calculation. The hash algorithm used to create message digest must be SHA-512. The answer is returned through ret, with 1 corresponding to a valid signature, and 0 corresponding to an invalid signature. More... | |
int | wc_ed25519ph_verify_msg (const byte *sig, word32 siglen, const byte *msg, word32 msgLen, int *ret, ed25519_key *key, const byte *context, byte contextLen) |
This function verifies the Ed25519 signature of a message to ensure authenticity. The context is included as part of the data verified. The message is pre-hashed before verification. It returns the answer through ret, with 1 corresponding to a valid signature, and 0 corresponding to an invalid signature. More... | |
int | wc_ed25519_init (ed25519_key *key) |
This function initializes an ed25519_key object for future use with message verification. More... | |
void | wc_ed25519_free (ed25519_key *key) |
This function frees an Ed25519 object after it has been used. More... | |
int | wc_ed25519_import_public (const byte *in, word32 inLen, ed25519_key *key) |
This function imports a public ed25519_key from a buffer containing the public key. This function will handle both compressed and uncompressed keys. The public key is checked that it matches the private key when one is present. More... | |
int | wc_ed25519_import_public_ex (const byte *in, word32 inLen, ed25519_key *key, int trusted) |
This function imports a public ed25519_key from a buffer containing the public key. This function will handle both compressed and uncompressed keys. Check public key matches private key, when present, when not trusted. More... | |
int | wc_ed25519_import_private_only (const byte *priv, word32 privSz, ed25519_key *key) |
This function imports an Ed25519 private key only from a buffer. More... | |
int | wc_ed25519_import_private_key (const byte *priv, word32 privSz, const byte *pub, word32 pubSz, ed25519_key *key) |
This function imports a public/private Ed25519 key pair from a pair of buffers. This function will handle both compressed and uncompressed keys. The public key is assumed to be untrusted and is checked against the private key. More... | |
int | wc_ed25519_import_private_key_ex (const byte *priv, word32 privSz, const byte *pub, word32 pubSz, ed25519_key *key, int trusted) |
This function imports a public/private Ed25519 key pair from a pair of buffers. This function will handle both compressed and uncompressed keys. The public is checked against private key if not trusted. More... | |
int | wc_ed25519_export_public (ed25519_key *key, byte *out, word32 *outLen) |
This function exports the private key from an ed25519_key structure. It stores the public key in the buffer out, and sets the bytes written to this buffer in outLen. More... | |
int | wc_ed25519_export_private_only (ed25519_key *key, byte *out, word32 *outLen) |
This function exports only the private key from an ed25519_key structure. It stores the private key in the buffer out, and sets the bytes written to this buffer in outLen. More... | |
int | wc_ed25519_export_private (ed25519_key *key, byte *out, word32 *outLen) |
This function exports the key pair from an ed25519_key structure. It stores the key pair in the buffer out, and sets the bytes written to this buffer in outLen. More... | |
int | wc_ed25519_export_key (ed25519_key *key, byte *priv, word32 *privSz, byte *pub, word32 *pubSz) |
This function exports the private and public key separately from an ed25519_key structure. It stores the private key in the buffer priv, and sets the bytes written to this buffer in privSz. It stores the public key in the buffer pub, and sets the bytes written to this buffer in pubSz. More... | |
int | wc_ed25519_check_key (ed25519_key *key) |
This function checks the public key in ed25519_key structure matches the private key. More... | |
int | wc_ed25519_size (ed25519_key *key) |
This function returns the size of an Ed25519 - 32 bytes. More... | |
int | wc_ed25519_priv_size (ed25519_key *key) |
This function returns the private key size (secret + public) in bytes. More... | |
int | wc_ed25519_pub_size (ed25519_key *key) |
This function returns the compressed key size in bytes (public key). More... | |
int | wc_ed25519_sig_size (ed25519_key *key) |
This function returns the size of an Ed25519 signature (64 in bytes). More... | |
int wc_ed25519_check_key | ( | ed25519_key * | key | ) |
This function checks the public key in ed25519_key structure matches the private key.
[in] | key | Pointer to an ed25519_key structure holding a private and public key. |
Example
int wc_ed25519_export_key | ( | ed25519_key * | key, |
byte * | priv, | ||
word32 * | privSz, | ||
byte * | pub, | ||
word32 * | pubSz | ||
) |
This function exports the private and public key separately from an ed25519_key structure. It stores the private key in the buffer priv, and sets the bytes written to this buffer in privSz. It stores the public key in the buffer pub, and sets the bytes written to this buffer in pubSz.
[in] | key | Pointer to an ed25519_key structure from which to export the key pair. |
[out] | priv | Pointer to the buffer in which to store the private key. |
[in,out] | privSz | Pointer to a word32 object with the size available in out. Set with the number of bytes written to out after successfully exporting the private key. |
[out] | pub | Pointer to the buffer in which to store the public key. |
[in,out] | pubSz | Pointer to a word32 object with the size available in out. Set with the number of bytes written to out after successfully exporting the public key. |
Example
int wc_ed25519_export_private | ( | ed25519_key * | key, |
byte * | out, | ||
word32 * | outLen | ||
) |
This function exports the key pair from an ed25519_key structure. It stores the key pair in the buffer out, and sets the bytes written to this buffer in outLen.
[in] | key | Pointer to an ed25519_key structure from which to export the key pair. |
[out] | out | Pointer to the buffer in which to store the key pair. |
[in,out] | outLen | Pointer to a word32 object with the size available in out. Set with the number of bytes written to out after successfully exporting the key pair. |
Example
int wc_ed25519_export_private_only | ( | ed25519_key * | key, |
byte * | out, | ||
word32 * | outLen | ||
) |
This function exports only the private key from an ed25519_key structure. It stores the private key in the buffer out, and sets the bytes written to this buffer in outLen.
[in] | key | Pointer to an ed25519_key structure from which to export the private key. |
[out] | out | Pointer to the buffer in which to store the private key. |
[in,out] | outLen | Pointer to a word32 object with the size available in out. Set with the number of bytes written to out after successfully exporting the private key. |
Example
int wc_ed25519_export_public | ( | ed25519_key * | key, |
byte * | out, | ||
word32 * | outLen | ||
) |
This function exports the private key from an ed25519_key structure. It stores the public key in the buffer out, and sets the bytes written to this buffer in outLen.
[in] | key | Pointer to an ed25519_key structure from which to export the public key. |
[out] | out | Pointer to the buffer in which to store the public key. |
[in,out] | outLen | Pointer to a word32 object with the size available in out. Set with the number of bytes written to out after successfully exporting the public key. |
Example
void wc_ed25519_free | ( | ed25519_key * | key | ) |
This function frees an Ed25519 object after it has been used.
[in,out] | key | Pointer to the ed25519_key object to free |
Example
int wc_ed25519_import_private_key | ( | const byte * | priv, |
word32 | privSz, | ||
const byte * | pub, | ||
word32 | pubSz, | ||
ed25519_key * | key | ||
) |
This function imports a public/private Ed25519 key pair from a pair of buffers. This function will handle both compressed and uncompressed keys. The public key is assumed to be untrusted and is checked against the private key.
[in] | priv | Pointer to the buffer containing the private key. |
[in] | privSz | Length of the private key. |
[in] | pub | Pointer to the buffer containing the public key. |
[in] | pubSz | Length of the public key. |
[in,out] | key | Pointer to the ed25519_key object in which to store the imported private/public key pair. |
Example
int wc_ed25519_import_private_key_ex | ( | const byte * | priv, |
word32 | privSz, | ||
const byte * | pub, | ||
word32 | pubSz, | ||
ed25519_key * | key, | ||
int | trusted | ||
) |
This function imports a public/private Ed25519 key pair from a pair of buffers. This function will handle both compressed and uncompressed keys. The public is checked against private key if not trusted.
[in] | priv | Pointer to the buffer containing the private key. |
[in] | privSz | Length of the private key. |
[in] | pub | Pointer to the buffer containing the public key. |
[in] | pubSz | Length of the public key. |
[in,out] | key | Pointer to the ed25519_key object in which to store the imported private/public key pair. |
[in] | trusted | Public key data is trusted or not. |
Example
int wc_ed25519_import_private_only | ( | const byte * | priv, |
word32 | privSz, | ||
ed25519_key * | key | ||
) |
This function imports an Ed25519 private key only from a buffer.
[in] | priv | Pointer to the buffer containing the private key. |
[in] | privSz | Length of the private key. |
[in,out] | key | Pointer to the ed25519_key object in which to store the imported private key. |
Example
int wc_ed25519_import_public | ( | const byte * | in, |
word32 | inLen, | ||
ed25519_key * | key | ||
) |
This function imports a public ed25519_key from a buffer containing the public key. This function will handle both compressed and uncompressed keys. The public key is checked that it matches the private key when one is present.
[in] | in | Pointer to the buffer containing the public key. |
[in] | inLen | Length of the buffer containing the public key. |
[in,out] | key | Pointer to the ed25519_key object in which to store the public key. |
Example
int wc_ed25519_import_public_ex | ( | const byte * | in, |
word32 | inLen, | ||
ed25519_key * | key, | ||
int | trusted | ||
) |
This function imports a public ed25519_key from a buffer containing the public key. This function will handle both compressed and uncompressed keys. Check public key matches private key, when present, when not trusted.
[in] | in | Pointer to the buffer containing the public key. |
[in] | inLen | Length of the buffer containing the public key. |
[in,out] | key | Pointer to the ed25519_key object in which to store the public key. |
[in] | trusted | Public key data is trusted or not. |
Example
int wc_ed25519_init | ( | ed25519_key * | key | ) |
This function initializes an ed25519_key object for future use with message verification.
[in,out] | key | Pointer to the ed25519_key object to initialize. |
Example
int wc_ed25519_make_key | ( | WC_RNG * | rng, |
int | keysize, | ||
ed25519_key * | key | ||
) |
This function generates a new Ed25519 key and stores it in key.
[in] | rng | Pointer to an initialized RNG object with which to generate the key. |
[in] | keysize | Length of key to generate. Should always be 32 for Ed25519. |
[in,out] | key | Pointer to the ed25519_key for which to generate a key. |
Example
int wc_ed25519_make_public | ( | ed25519_key * | key, |
unsigned char * | pubKey, | ||
word32 | pubKeySz | ||
) |
This function generates the Ed25519 public key from the private key, stored in the ed25519_key object. It stores the public key in the buffer pubKey.
[in] | key | Pointer to the ed25519_key for which to generate a key. |
[out] | pubKey | Pointer to the buffer in which to store the public key. |
[in] | pubKeySz | Size of the public key. Should be ED25519_PUB_KEY_SIZE. |
Example
int wc_ed25519_priv_size | ( | ed25519_key * | key | ) |
This function returns the private key size (secret + public) in bytes.
[in] | key | Pointer to an ed25519_key structure for which to get the key size. |
Example
int wc_ed25519_pub_size | ( | ed25519_key * | key | ) |
This function returns the compressed key size in bytes (public key).
[in] | key | Pointer to an ed25519_key structure for which to get the key size. |
Example
int wc_ed25519_sig_size | ( | ed25519_key * | key | ) |
This function returns the size of an Ed25519 signature (64 in bytes).
[in] | key | Pointer to an ed25519_key structure for which to get the signature size. |
Example
int wc_ed25519_sign_msg | ( | const byte * | in, |
word32 | inlen, | ||
byte * | out, | ||
word32 * | outlen, | ||
ed25519_key * | key | ||
) |
This function signs a message using an ed25519_key object to guarantee authenticity.
[in] | in | Pointer to the buffer containing the message to sign. |
[in] | inlen | Length of the message to sign. |
[out] | out | Buffer in which to store the generated signature. |
[in,out] | outlen | Maximum length of the output buffer. Will store the bytes written to out upon successfully generating a message signature. |
[in] | key | Pointer to a private ed25519_key with which to generate the signature. |
Example
int wc_ed25519_size | ( | ed25519_key * | key | ) |
This function returns the size of an Ed25519 - 32 bytes.
[in] | key | Pointer to an ed25519_key structure for which to get the key size. |
Example
int wc_ed25519_verify_msg | ( | const byte * | sig, |
word32 | siglen, | ||
const byte * | msg, | ||
word32 | msgLen, | ||
int * | ret, | ||
ed25519_key * | key | ||
) |
This function verifies the Ed25519 signature of a message to ensure authenticity. It returns the answer through ret, with 1 corresponding to a valid signature, and 0 corresponding to an invalid signature.
[in] | sig | Pointer to the buffer containing the signature to verify. |
[in] | siglen | Length of the signature to verify. |
[in] | msg | Pointer to the buffer containing the message to verify. |
[in] | msgLen | Length of the message to verify. |
[out] | ret | Pointer to the result of the verification. 1 indicates the message was successfully verified. |
[in] | key | Pointer to a public Ed25519 key with which to verify the signature. |
Example
int wc_ed25519ctx_sign_msg | ( | const byte * | in, |
word32 | inlen, | ||
byte * | out, | ||
word32 * | outlen, | ||
ed25519_key * | key, | ||
const byte * | context, | ||
byte | contextLen | ||
) |
This function signs a message using an ed25519_key object to guarantee authenticity. The context is part of the data signed.
[in] | in | Pointer to the buffer containing the message to sign. |
[in] | inlen | Length of the message to sign. |
[out] | out | Buffer in which to store the generated signature. |
[in,out] | outlen | Maximum length of the output buffer. Will store the bytes written to out upon successfully generating a message signature. |
[in] | key | Pointer to a private ed25519_key with which to generate the signature. |
[in] | context | Pointer to the buffer containing the context for which message is being signed. |
[in] | contextLen | Length of the context buffer. |
Example
int wc_ed25519ctx_verify_msg | ( | const byte * | sig, |
word32 | siglen, | ||
const byte * | msg, | ||
word32 | msgLen, | ||
int * | ret, | ||
ed25519_key * | key, | ||
const byte * | context, | ||
byte | contextLen | ||
) |
This function verifies the Ed25519 signature of a message to ensure authenticity. The context is included as part of the data verified. It returns the answer through ret, with 1 corresponding to a valid signature, and 0 corresponding to an invalid signature.
[in] | sig | Pointer to the buffer containing the signature to verify. |
[in] | siglen | Length of the signature to verify. |
[in] | msg | Pointer to the buffer containing the message to verify. |
[in] | msgLen | Length of the message to verify. |
[out] | ret | Pointer to the result of the verification. 1 indicates the message was successfully verified. |
[in] | key | Pointer to a public Ed25519 key with which to verify the signature. |
[in] | context | Pointer to the buffer containing the context for which the message was signed. |
[in] | contextLen | Length of the context buffer. |
Example
int wc_ed25519ph_sign_hash | ( | const byte * | hash, |
word32 | hashLen, | ||
byte * | out, | ||
word32 * | outLen, | ||
ed25519_key * | key, | ||
const byte * | context, | ||
byte | contextLen | ||
) |
This function signs a message digest using an ed25519_key object to guarantee authenticity. The context is included as part of the data signed. The message is pre-hashed before signature calculation.
[in] | hash | Pointer to the buffer containing the hash of the message to sign. |
[in] | hashLen | Length of the hash of the message to sign. |
[out] | out | Buffer in which to store the generated signature. |
[in,out] | outlen | Maximum length of the output buffer. Will store the bytes written to out upon successfully generating a message signature. |
[in] | key | Pointer to a private ed25519_key with which to generate the signature. |
[in] | context | Pointer to the buffer containing the context for which message is being signed. |
[in] | contextLen | Length of the context buffer. |
Example
int wc_ed25519ph_sign_msg | ( | const byte * | in, |
word32 | inlen, | ||
byte * | out, | ||
word32 * | outlen, | ||
ed25519_key * | key, | ||
const byte * | context, | ||
byte | contextLen | ||
) |
This function signs a message using an ed25519_key object to guarantee authenticity. The context is included as part of the data signed. The message is pre-hashed before signature calculation.
[in] | in | Pointer to the buffer containing the message to sign. |
[in] | inlen | Length of the message to sign. |
[out] | out | Buffer in which to store the generated signature. |
[in,out] | outlen | Maximum length of the output buffer. Will store the bytes written to out upon successfully generating a message signature. |
[in] | key | Pointer to a private ed25519_key with which to generate the signature. |
[in] | context | Pointer to the buffer containing the context for which message is being signed. |
[in] | contextLen | Length of the context buffer. |
Example
int wc_ed25519ph_verify_hash | ( | const byte * | sig, |
word32 | siglen, | ||
const byte * | hash, | ||
word32 | hashLen, | ||
int * | ret, | ||
ed25519_key * | key, | ||
const byte * | context, | ||
byte | contextLen | ||
) |
This function verifies the Ed25519 signature of the digest of a message to ensure authenticity. The context is included as part of the data verified. The hash is the pre-hashed message before signature calculation. The hash algorithm used to create message digest must be SHA-512. The answer is returned through ret, with 1 corresponding to a valid signature, and 0 corresponding to an invalid signature.
[in] | sig | Pointer to the buffer containing the signature to verify. |
[in] | siglen | Length of the signature to verify. |
[in] | hash | Pointer to the buffer containing the hash of the message to verify. |
[in] | hashLen | Length of the hash to verify. |
[out] | ret | Pointer to the result of the verification. 1 indicates the message was successfully verified. |
[in] | key | Pointer to a public Ed25519 key with which to verify the signature. |
[in] | context | Pointer to the buffer containing the context for which the message was signed. |
[in] | contextLen | Length of the context buffer. |
Example
int wc_ed25519ph_verify_msg | ( | const byte * | sig, |
word32 | siglen, | ||
const byte * | msg, | ||
word32 | msgLen, | ||
int * | ret, | ||
ed25519_key * | key, | ||
const byte * | context, | ||
byte | contextLen | ||
) |
This function verifies the Ed25519 signature of a message to ensure authenticity. The context is included as part of the data verified. The message is pre-hashed before verification. It returns the answer through ret, with 1 corresponding to a valid signature, and 0 corresponding to an invalid signature.
[in] | sig | Pointer to the buffer containing the signature to verify. |
[in] | siglen | Length of the signature to verify. |
[in] | msg | Pointer to the buffer containing the message to verify. |
[in] | msgLen | Length of the message to verify. |
[out] | ret | Pointer to the result of the verification. 1 indicates the message was successfully verified. |
[in] | key | Pointer to a public Ed25519 key with which to verify the signature. |
[in] | context | Pointer to the buffer containing the context for which the message was signed. |
[in] | contextLen | Length of the context buffer. |
Example