Function webcryptobox::derive_key

source ·
pub fn derive_key(
    private_key: EcKey<Private>,
    public_key: EcKey<Public>
) -> Result<Vec<u8>, ErrorStack>
Expand description

Derives AES key material to be used with encrypt and decrypt from given private and public key.

§Example:

let alice = webcryptobox::generate_private_key().unwrap();
let bob = webcryptobox::generate_private_key().unwrap();
let bobs_public_key = webcryptobox::get_public_key(&bob).unwrap();
let key = webcryptobox::derive_key(alice, bobs_public_key);