Module: diffie_hellman_ratchet_curve448
- class doubleratchet.recommended.diffie_hellman_ratchet_curve448.DiffieHellmanRatchet[source]
Bases:
DiffieHellmanRatchetAn implementation of
DiffieHellmanRatchetusing Curve448 keys and performing X448 key exchanges.Implementation relies on the Python package cryptography.
- static _generate_priv()[source]
- Return type:
- Returns:
A freshly generated private key, capable of performing Diffie-Hellman key exchanges with the public key of another party.
Note
This function is recommended to generate a key pair based on the Curve25519 or Curve448 elliptic curves (https://signal.org/docs/specifications/doubleratchet/#recommended-cryptographic-algorithms).
- static _derive_pub(priv)[source]
Derive the public key from a private key as generated by
_generate_priv().- Parameters:
priv (
bytes) – The private key as returned by_generate_priv().- Return type:
- Returns:
The public key corresponding to the private key.
- static _perform_diffie_hellman(own_priv, other_pub)[source]
- Parameters:
- Return type:
- Returns:
A shared secret agreed on via Diffie-Hellman. This method is recommended to perform X25519 or X448. There is no need to check for invalid public keys (https://signal.org/docs/specifications/doubleratchet/#recommended-cryptographic-algorithms).