Ed25519

How to use the crypto_condor.primitives.ed25519 module to test implementations of Ed25519.

Test signing

crypto_condor.primitives.ed25519.test_sign(sign, compliance=True, resilience=True)

Tests a function that generates signatures with Ed25519.

Calls the sign function on valid keys and messages to generate signatures. The signatures are compared to the test vector values. The test passes if all signatures are correct.

Parameters:
  • sign (Sign) – The function to test. Must follow Sign.

  • compliance (bool) – If True, compliance test vectors are used if available.

  • resilience (bool) – If True, resilience test vectors are used if available.

Returns:

An instance of ResultsDict, with one Results per test vectors file used.

Return type:

ResultsDict

Test verifying

crypto_condor.primitives.ed25519.test_verify(verify, compliance=True, resilience=True)

Tests a function that verifies Ed25519 signatures.

Calls the verify function to verify Ed25519 signatures. Keys and messages are valid values. There are valid and invalid signatures: the test passes if the implementation correctly verifies all valid signatures and rejects all invalid signatures.

Parameters:
  • verify (Verify) – The function to test. Must follow Verify.

  • compliance (bool) – If True, compliance test vectors are used if available.

  • resilience (bool) – If True, resilience test vectors are used if available.

Returns:

An instance of ResultsDict, with one Results per test vectors file used.

Return type:

ResultsDict

Protocols

protocol crypto_condor.primitives.ed25519.Sign

Represents a function that signs with Ed25519.

Classes that implement this protocol must have the following methods / attributes:

__call__(sk, msg)

Signs a message with Ed25519.

Parameters:
  • sk (bytes) – The raw private key.

  • msg (bytes) – The message to sign.

Returns:

The Ed25519 signature.

Return type:

bytes

protocol crypto_condor.primitives.ed25519.Verify

Represents a function that verifies Ed25519 signatures.

Classes that implement this protocol must have the following methods / attributes:

__call__(pk, msg, sig)

Verifies an Ed25519 signature.

Parameters:
  • pk (bytes) – The raw 32-byte public key.

  • msg (bytes) – The data that was signed.

  • sig (bytes) – The signature to verify.

Returns:

True if the signature is valid, False otherwise.

Return type:

bool

Parameters

enum crypto_condor.primitives.ed25519.Variant(value)

Ed25519 variants.

Member Type:

str

Valid values are as follows:

ED25519 = <Variant.ED25519: 'Ed25519'>
ED25519PH = <Variant.ED25519PH: 'Ed25519ph'>
ED25519CTX = <Variant.ED25519CTX: 'Ed25519ctx'>