Module dryoc::kx::protected

source ·
Available on crate feature nightly only.
Expand description

Protected memory type aliases for Session

This mod provides re-exports of type aliases for protected memory usage with Session. These type aliases are provided for convenience.

Example

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

// Generate random client/server keypairs
let client_keypair =
    LockedROKeyPair::gen_readonly_locked_keypair().expect("couldn't generate client keypair");
let server_keypair =
    LockedROKeyPair::gen_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

Type Aliases

  • Heap-allocated, paged-aligned keypair type alias for use with protected memory
  • Heap-allocated, paged-aligned keypair type alias for use with protected memory
  • Locked session keys type alias, for use with protected memory
  • Heap-allocated, paged-aligned public key type alias for use with protected memory
  • Heap-allocated, paged-aligned secret key type alias for use with protected memory
  • Heap-allocated, paged-aligned session key type alias for use with protected memory