Python's cryptography
module defines the X25519PrivateKey
and X25519PublicKey
classes. But while X25519PublicKey
has a public_bytes()
method for serialization, a corresponding private_bytes
method on X25519PrivateKey
is missing.
Strangely, a _from_private_bytes()
classmethod is present, suggesting some way of exporting the key.
How can I export the private key for saving?
Context: I need this for a noiseprotocol
connection with static public keys (Noise_XX_*
) where I need to provide pre-generated and persisted keys.