dalek-cryptography / x25519-dalek

X25519 elliptic curve Diffie-Hellman key exchange in pure-Rust, using curve25519-dalek.
BSD 3-Clause "New" or "Revised" License
329 stars 133 forks source link

Static secret keys #35

Closed DebugSteven closed 5 years ago

DebugSteven commented 5 years ago

Currently, the API uses only ephemeral secret keys for Diffie-Hellman & everything else is forced to use the bare x25519 function.

This PR implements another secret key type, StaticSecret. We have two secret key types, EphemeralSecret & StaticSecret, & one public key type, PublicKey. This enables users to be able to save & load secret keys using StaticSecret & allows us to use the same logic to create PublicKeys from both secret key types.

In a key exchange, you don't have a way to know whether or not they'll ever reuse their secret key. Since creating a PublicKey is a conversion from a secret key, this name better reflects that the value might not be ephemeral.

hdevalence commented 5 years ago

Thanks! I added a commit that updates the README examples and ensures that the doctests are run in Travis.

hdevalence commented 5 years ago

I can release these changes as 0.5.0!