CRYPTO_ED25519_SIGN(3MONOCYPHER)

πŸ“¦
version 4.0.3 Β· 2 versions
, in nixpkgs unstable

πŸ’– NAME πŸ’–

okay bestie, this page is CRYPTO_ED25519_SIGN(3MONOCYPHER) β€” it’s all about public key signatures and the little function family that handles them: crypto_ed25519_sign, crypto_ed25519_check, crypto_ed25519_key_pair, crypto_ed25519_ph_sign, and crypto_ed25519_ph_check.


✨ SYNOPSIS ✨

#include <monocypher-ed25519.h>

void
crypto_ed25519_sign(uint8_t signature[64], const uint8_t secret_key[64],
    const uint8_t *message, size_t message_size);

int
crypto_ed25519_check(const uint8_t signature[64],
    const uint8_t public_key[32], const uint8_t *message,
    size_t message_size);

void
crypto_ed25519_key_pair(uint8_t secret_key[64], uint8_t public_key[32],
    uint8_t seed[32]);

void
crypto_ed25519_ph_sign(uint8_t signature[64],
    const uint8_t secret_key[64], const uint8_t message_hash[64]);

int
crypto_ed25519_ph_check(const uint8_t signature[64],
    const uint8_t public_key[32], const uint8_t message_hash[64]);

πŸ¦‹ DESCRIPTION πŸ¦‹

The crypto_ed25519_sign() and crypto_ed25519_check() functions provide Ed25519 public key signatures and verification. crypto_ed25519_key_pair() computes the private and public keys from a random seed. crypto_ed25519_ph_sign() and crypto_ed25519_ph_check() implement Ed25519ph. They require hashing the message with crypto_sha512(3monocypher) before calling them. The arguments are:

  • seed β€” Random seed, freshly generated and used only once. It is automatically wiped by crypto_ed25519_key_pair(). See intro(3monocypher) about random number generation (use your operating system's random number generator).
  • signature β€” The signature.
  • secret_key β€” A secret key generated by crypto_ed25519_key_pair(), known only to you. Internally the secret key is made up of the seed and the public key. They are bundled together to avoid misuse, and should be treated as a unit.
  • public_key β€” The associated public key, known to everyone.
  • message β€” The message to sign.
  • message_size β€” Length of message, in bytes.
  • message_hash β€” Hash of the message to sign.

🌈 RETURN VALUES 🌈

crypto_ed25519_key_pair(), crypto_ed25519_sign(), and crypto_ed25519_ph_sign() return nothing.

crypto_ed25519_check() and crypto_ed25519_ph_check() return 0 for legitimate messages and -1 for forgeries. simple as that, bestie 🫢


🌸 SEE ALSO 🌸


πŸ‘‘ STANDARDS πŸ‘‘

These functions implement Ed25519 as described in RFC 8032. periodt ✨


πŸ’€ HISTORY πŸ’€

The crypto_ed25519_sign(), crypto_ed25519_check(), and crypto_ed25519_public_key() functions appeared in Monocypher 3.0.0. They replace recompilation of Monocypher with the ED25519_SHA512 preprocessor definition.

In Monocypher 4.0.0, the incremental and custom hash API removed. The main interface was also reworked to avoid misuse, and crypto_ed25519_key_pair() replaced crypto_ed25519_public_key().


🚨 CAVEATS 🚨

⚠️ Monocypher does not perform any input validation. Any deviation from the specified input and output length ranges results in undefined behaviour. Make sure your inputs are correct.

like, do not play games with your lengths, bestie β€” that’s an undefined behaviour situation and we are not about that πŸ’€


πŸ”₯ SECURITY CONSIDERATIONS πŸ”₯

🧚 Signature malleability 🧚

Signature malleability is the ability of an attacker to produce a valid signature with knowledge of only an existing signature and the public key. Monocypher prevents that by checking the encoding of the signature, and guarantees that generating new signatures requires the private key.

On the other hand, EdDSA signatures are not unique like cryptographic hashes. The signing procedure is deterministic by specification and crypto_ed25519_sign() follows this specification. However, someone with the private key can generate arbitrarily many valid, canonical, and different signatures of the same message. Because of this, never assume that signatures are unique.

⚑ Fault injection and power analysis ⚑

Fault injection (also known as glitching) and power analysis may be used to manipulate the resulting signature and recover the secret key in some cases. This requires hardware access. We can try to mitigate this attack by prefixing all hashes a random data block, in a construction similar to Ed25519ctx. Note that there may still be other power-related side channels (such as if the CPU leaks information when an operation overflows a register) that must be considered.


okay that’s the whole lore, bestie πŸ’– source/version situation is Debian, and the date on this is March 01, 2022 β€” CRYPTO_ED25519_SIGN(3MONOCYPHER) out, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from
  • nixpkgs unstable: monocypher 4.0.3
  • πŸ“œ the page's license: BSD-2-Clause OR CC0-1.0
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms