Skip to content

Commit

Permalink
Do not leak a private key that has a small typo
Browse files Browse the repository at this point in the history
Signed-off-by: Jacinta Ferrant <jacinta@trustmachines.co>
  • Loading branch information
jferrant committed Sep 27, 2024
1 parent e53547c commit ff58018
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions stacks-signer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,21 +288,11 @@ impl TryFrom<RawConfigFile> for GlobalConfig {
ConfigError::BadField("endpoint".to_string(), raw_data.endpoint.clone())
})?;

let stacks_private_key =
StacksPrivateKey::from_hex(&raw_data.stacks_private_key).map_err(|_| {
ConfigError::BadField(
"stacks_private_key".to_string(),
raw_data.stacks_private_key.clone(),
)
})?;
let stacks_private_key = StacksPrivateKey::from_hex(&raw_data.stacks_private_key)
.map_err(|e| ConfigError::BadField("stacks_private_key".to_string(), e.into()))?;

let ecdsa_private_key =
Scalar::try_from(&stacks_private_key.to_bytes()[..32]).map_err(|_| {
ConfigError::BadField(
"stacks_private_key".to_string(),
raw_data.stacks_private_key.clone(),
)
})?;
let ecdsa_private_key = Scalar::try_from(&stacks_private_key.to_bytes()[..32])
.map_err(|e| ConfigError::BadField("stacks_private_key".to_string(), e.to_string()))?;
let stacks_public_key = StacksPublicKey::from_private(&stacks_private_key);
let signer_hash = Hash160::from_data(stacks_public_key.to_bytes_compressed().as_slice());
let stacks_address =
Expand Down

0 comments on commit ff58018

Please sign in to comment.