Florian Geiger 2 years ago
parent
commit
e943e4cbb5
2 changed files with 13 additions and 1 deletions
  1. 11
    1
      src/bin/client.rs
  2. 2
    0
      src/bin/constants.rs

+ 11
- 1
src/bin/client.rs View File

@@ -18,7 +18,17 @@ fn main() {
0xbd, 0xdd, 0x15, 0xc3, 0xb5, 0x96, 0x41, 0x17, 0x4e, 0xc9, 0x67, 0x8a, 0x53, 0x78,
0x9d, 0x92, 0xc7, 0x54,
]);
let (salsa_box, pub_key) = generate_box(bob_init_pub_key.clone());

// Generate a random secret key.
// NOTE: The secret key bytes can be accessed by calling `secret_key.as_bytes()`
let own_secret_key = SecretKey::generate(&mut OsRng);

// Get the public key for the secret key we just generated
let own_public_key = own_secret_key.public_key().clone();

// Create a `SalsaBox` by performing Diffie-Hellman key agreement between
// the two keys.
let salsa_box = SalsaBox::new(&bob_init_pub_key, &own_secret_key);

loop {
let mut buffer = String::new();

+ 2
- 0
src/bin/constants.rs View File

@@ -0,0 +1,2 @@
pub const KEYBYTE: u8 = 0b1;
pub const MSGBYTE: u8 = 0b01;

Loading…
Cancel
Save