cas-lib 0.2.77

A function wrapper layer for RustCrypto and Dalek-Cryptography. Intended to be used in FFI situations with a global heap deallactor at the top level project.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#[cfg(test)]
mod key_exchange {
    use cas_lib::key_exchange::{cas_key_exchange::CASKeyExchange, x25519::{X25519SecretPublicKeyResult, X25519}};

    #[test]
    pub fn x25519_diffie_hellman() {
        let alice: X25519SecretPublicKeyResult = X25519::generate_secret_and_public_key();
        let bob: X25519SecretPublicKeyResult = X25519::generate_secret_and_public_key();

        let alice_shared_secret = X25519::diffie_hellman(alice.secret_key.clone(), bob.public_key.clone());
        let bob_shared_secret = X25519::diffie_hellman(bob.secret_key.clone(), alice.public_key.clone());
        assert_eq!(alice_shared_secret, bob_shared_secret);
    }
}