[secretstore]: don't sign message with only zeroes (#11561)
This commit is contained in:
parent
b7c97f90b6
commit
e88ac4dbcf
@ -18,16 +18,17 @@
|
|||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use account_utils::AccountProvider;
|
use account_utils::AccountProvider;
|
||||||
use dir::default_data_path;
|
use dir::default_data_path;
|
||||||
use dir::helpers::replace_home;
|
use dir::helpers::replace_home;
|
||||||
use ethcore::client::Client;
|
use ethcore::client::Client;
|
||||||
use ethcore::miner::Miner;
|
use ethcore::miner::Miner;
|
||||||
|
use ethereum_types::Address;
|
||||||
use ethkey::Password;
|
use ethkey::Password;
|
||||||
use parity_crypto::publickey::{Secret, Public};
|
use parity_crypto::publickey::{Secret, Public};
|
||||||
use sync::SyncProvider;
|
|
||||||
use ethereum_types::Address;
|
|
||||||
use parity_runtime::Executor;
|
use parity_runtime::Executor;
|
||||||
|
use sync::SyncProvider;
|
||||||
|
|
||||||
/// This node secret key.
|
/// This node secret key.
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
@ -123,14 +124,16 @@ mod server {
|
|||||||
#[cfg(feature = "secretstore")]
|
#[cfg(feature = "secretstore")]
|
||||||
mod server {
|
mod server {
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use parity_secretstore;
|
|
||||||
use parity_crypto::publickey::KeyPair;
|
use parity_crypto::publickey::KeyPair;
|
||||||
use ansi_term::Colour::{Red, White};
|
use ansi_term::Colour::{Red, White};
|
||||||
|
use ethereum_types::H256;
|
||||||
use super::{Configuration, Dependencies, NodeSecretKey, ContractAddress, Executor};
|
use super::{Configuration, Dependencies, NodeSecretKey, ContractAddress, Executor};
|
||||||
use super::super::TrustedClient;
|
use super::super::TrustedClient;
|
||||||
#[cfg(feature = "accounts")]
|
#[cfg(feature = "accounts")]
|
||||||
use super::super::KeyStoreNodeKeyPair;
|
use super::super::KeyStoreNodeKeyPair;
|
||||||
|
|
||||||
|
const SECP_TEST_MESSAGE: H256 = H256([1_u8; 32]);
|
||||||
|
|
||||||
fn into_service_contract_address(address: ContractAddress) -> parity_secretstore::ContractAddress {
|
fn into_service_contract_address(address: ContractAddress) -> parity_secretstore::ContractAddress {
|
||||||
match address {
|
match address {
|
||||||
ContractAddress::Registry => parity_secretstore::ContractAddress::Registry,
|
ContractAddress::Registry => parity_secretstore::ContractAddress::Registry,
|
||||||
@ -163,10 +166,10 @@ mod server {
|
|||||||
|
|
||||||
// Attempt to sign in the engine signer.
|
// Attempt to sign in the engine signer.
|
||||||
let password = deps.accounts_passwords.iter()
|
let password = deps.accounts_passwords.iter()
|
||||||
.find(|p| deps.account_provider.sign(account.clone(), Some((*p).clone()), Default::default()).is_ok())
|
.find(|p| deps.account_provider.sign(account.clone(), Some((*p).clone()), SECP_TEST_MESSAGE).is_ok())
|
||||||
.ok_or_else(|| format!("No valid password for the secret store node account {}", account))?;
|
.ok_or_else(|| format!("No valid password for the secret store node account {}", account))?;
|
||||||
Arc::new(KeyStoreNodeKeyPair::new(deps.account_provider, account, password.clone())
|
Arc::new(KeyStoreNodeKeyPair::new(deps.account_provider, account, password.clone())
|
||||||
.map_err(|e| format!("{}", e))?)
|
.map_err(|e| e.to_string())?)
|
||||||
},
|
},
|
||||||
None => return Err("self secret is required when using secretstore".into()),
|
None => return Err("self secret is required when using secretstore".into()),
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user