update to use SharedSecret instead
This commit is contained in:
parent
3f58aab317
commit
4b3fcec525
1 changed files with 2 additions and 2 deletions
|
|
@ -39,7 +39,7 @@ impl EncryptedStream {
|
||||||
let mut nonce_bytes = [0u8; 12];
|
let mut nonce_bytes = [0u8; 12];
|
||||||
socket.read_exact(&mut nonce_bytes)?;
|
socket.read_exact(&mut nonce_bytes)?;
|
||||||
|
|
||||||
let key = blake3::derive_key(KEY_DERIVATION_CONTEXT, &shared_secret.to_bytes());
|
let key = shared_secret.derive_key(|bytes| blake3::derive_key(KEY_DERIVATION_CONTEXT, &bytes));
|
||||||
|
|
||||||
Ok(EncryptedStream::wrap(socket, key, nonce_bytes))
|
Ok(EncryptedStream::wrap(socket, key, nonce_bytes))
|
||||||
}
|
}
|
||||||
|
|
@ -88,7 +88,7 @@ impl TryFrom<TcpStream> for EncryptedStream {
|
||||||
|
|
||||||
socket.write(&nonce_bytes)?;
|
socket.write(&nonce_bytes)?;
|
||||||
|
|
||||||
let key = blake3::derive_key(KEY_DERIVATION_CONTEXT, &shared_secret.to_bytes());
|
let key = shared_secret.derive_key(|bytes| blake3::derive_key(KEY_DERIVATION_CONTEXT, &bytes));
|
||||||
|
|
||||||
Ok(EncryptedStream::wrap(socket, key, nonce_bytes))
|
Ok(EncryptedStream::wrap(socket, key, nonce_bytes))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue