exonum_crypto::x25519

Function into_x25519_keypair

Source
pub fn into_x25519_keypair(
    pk: PublicKey,
    sk: SecretKey,
) -> Option<(PublicKey, SecretKey)>
Expand description

Converts Ed25519 keys to Curve25519.

Ed25519 keys used for signatures can be converted to Curve25519 and used for Diffie-Hellman key exchange.

ยงExamples

The example below generates a pair of secret and public Ed25519 keys and converts it to pair of Curve25519 keys.


let (pk, sk) = exonum_crypto::gen_keypair();
let (public_key, secret_key) = exonum_crypto::x25519::into_x25519_keypair(pk, sk).unwrap();