Skip to main content

Module protected

Module protected 

Source
Available on crate feature protected only.
Expand description

§Protected memory type aliases for Session

Protected-memory aliases for key exchange.

§Example

use dryoc::kx::Session;
use dryoc::kx::protected::*;

// Generate random client/server keypairs
let client_keypair = LockedROKeyPair::generate_readonly_locked_keypair()
    .expect("couldn't generate client keypair");
let server_keypair = LockedROKeyPair::generate_readonly_locked_keypair()
    .expect("couldn't generate server keypair");

// Compute client session keys, into default stack-allocated byte array
let client_session_keys: LockedSession =
    Session::new_client(&client_keypair, &server_keypair.public_key)
        .expect("compute client failed");

// Compute server session keys, into default stack-allocated byte array
let server_session_keys: LockedSession =
    Session::new_server(&server_keypair, &client_keypair.public_key)
        .expect("compute client failed");

let (client_rx, client_tx) = client_session_keys.into_parts();
let (server_rx, server_tx) = server_session_keys.into_parts();

// Client Rx should match server Tx keys
assert_eq!(client_rx.as_slice(), server_tx.as_slice());
// Client Tx should match server Rx keys
assert_eq!(client_tx.as_slice(), server_rx.as_slice());

Re-exports§

pub use crate::keypair::protected::*;

Type Aliases§

LockedKeyPair
Heap-allocated, page-aligned keypair type alias for use with protected memory
LockedROKeyPair
Heap-allocated, page-aligned keypair type alias for use with protected memory
LockedSession
Locked session keys type alias, for use with protected memory
PublicKey
Heap-allocated, page-aligned public key type alias for use with protected memory
SecretKey
Heap-allocated, page-aligned secret key type alias for use with protected memory
SessionKey
Heap-allocated, page-aligned session key type alias for use with protected memory