From fed486493967c4d457b12e107acfe1675ea92092 Mon Sep 17 00:00:00 2001 From: Toralf Wittner Date: Thu, 15 Mar 2018 16:49:13 +0100 Subject: [PATCH] secret_store: use `ecies::encrypt`/`ecies::decrypt`. (#8125) --- secret_store/src/key_server_cluster/io/message.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/secret_store/src/key_server_cluster/io/message.rs b/secret_store/src/key_server_cluster/io/message.rs index 32f0fc54a..94030ef41 100644 --- a/secret_store/src/key_server_cluster/io/message.rs +++ b/secret_store/src/key_server_cluster/io/message.rs @@ -19,7 +19,7 @@ use std::u16; use std::ops::Deref; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; use serde_json; -use ethcrypto::ecies::{encrypt_single_message, decrypt_single_message}; +use ethcrypto::ecies; use ethkey::{Secret, KeyPair}; use ethkey::math::curve_order; use ethereum_types::{H256, U256}; @@ -241,7 +241,7 @@ pub fn deserialize_message(header: &MessageHeader, payload: Vec) -> Result Result { let mut header: Vec<_> = message.into(); let payload = header.split_off(MESSAGE_HEADER_SIZE); - let encrypted_payload = encrypt_single_message(key.public(), &payload)?; + let encrypted_payload = ecies::encrypt(key.public(), &[], &payload)?; let header = deserialize_header(&header)?; build_serialized_message(header, encrypted_payload) @@ -249,7 +249,7 @@ pub fn encrypt_message(key: &KeyPair, message: SerializedMessage) -> Result) -> Result, Error> { - Ok(decrypt_single_message(key.secret(), &payload)?) + Ok(ecies::decrypt(key.secret(), &[], &payload)?) } /// Fix shared encryption key.