Skip to main content

is_valid_public_key

Function is_valid_public_key 

Source
pub fn is_valid_public_key<PK: ByteArray<CRYPTO_SIGN_PUBLICKEYBYTES>>(
    key: &PK,
) -> bool
Expand description

Checks if the given key is a valid prime-order Ed25519 public key.

The canonical compressed encoding is required. The high bit, which encodes the sign of the x-coordinate, may legitimately be set.

This is a strict prime-subgroup policy, not a generic Ed25519 signature validity predicate. Use it when an application or point-arithmetic protocol requires canonical, nonidentity, prime-order keys. Verify signatures with SignedMessage::verify or crypto_sign_verify_detached instead; some signature profiles intentionally define different point-acceptance rules.

Use crate::keypair::is_valid_public_key for X25519 keys used with crypto_box.