x25519

How to use the crypto_condor.primitives.x25519 module to test implementations of x25519.

Test key exchange

crypto_condor.primitives.x25519.test_exchange(exchange, compliance, resilience)

Tests a function implementing the X25519 key exchange.

Calls the exchange function to perform a X25519 key exchange.

Compliance test vectors from RFC 7749 are all valid, the implementation is expected to return the correct shared secret.

Resilience test vectors from Wycheproof are either valid or acceptable. The latter include edge cases that are not necessarily forbidden by the RFC.

Parameters:
  • exchange (Exchange) – The function to test. Must follow Exchange.

  • compliance (bool) – Whether to use compliance test vectors.

  • resilience (bool) – Whether to use resilience test vectors.

Protocols

protocol crypto_condor.primitives.x25519.Exchange

Represents an X25519 key exchange.

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

__call__(secret_key, peer_key)

Performs an X25519 key exchange.

Parameters:
  • secret_key (bytes) – “Our” secret key.

  • peer_key (bytes) – The “peer” public key.

Returns:

The resulting shared secret.

Return type:

bytes