Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Replace deprecated functions
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  • Loading branch information
ggwpez committed Aug 21, 2023
1 parent d8e8611 commit bbf19ac
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions primitives/statement-store/src/ecies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ fn kdf(shared_secret: &[u8]) -> [u8; AES_KEY_LEN] {
/// Encrypt `plaintext` with the given public x25519 public key. Decryption can be performed with
/// the matching secret key.
pub fn encrypt_x25519(pk: &PublicKey, plaintext: &[u8]) -> Result<Vec<u8>, Error> {
let ephemeral_sk = x25519_dalek::StaticSecret::new(OsRng);
let ephemeral_sk = x25519_dalek::StaticSecret::random_from_rng(OsRng);
let ephemeral_pk = x25519_dalek::PublicKey::from(&ephemeral_sk);

let mut shared_secret = ephemeral_sk.diffie_hellman(pk).to_bytes().to_vec();
Expand Down Expand Up @@ -135,7 +135,7 @@ mod test {

#[test]
fn basic_x25519_encryption() {
let sk = SecretKey::new(OsRng);
let sk = SecretKey::random_from_rng(OsRng);
let pk = PublicKey::from(&sk);

let plain_message = b"An important secret message";
Expand All @@ -159,7 +159,7 @@ mod test {

#[test]
fn fails_on_bad_data() {
let sk = SecretKey::new(OsRng);
let sk = SecretKey::random_from_rng(OsRng);
let pk = PublicKey::from(&sk);

let plain_message = b"An important secret message";
Expand Down

0 comments on commit bbf19ac

Please sign in to comment.