Skip to content

Commit

Permalink
fix Pk size check (#361)
Browse files Browse the repository at this point in the history
* more descriptive error

* fix key size check
  • Loading branch information
paspo authored Jan 31, 2024
1 parent 778c89e commit 94ae514
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ pub fn gen_sk(wait: u64) -> (String, Option<sign::SecretKey>) {
let pk = base64::encode(&tmp[sign::SECRETKEYBYTES / 2..]);
log::info!("Private key comes from {}", sk_file);
return (pk, Some(sign::SecretKey(tmp)));
} else {
log::error!("Malformed private key. You probably have a trailing newline in the secret key file.");
std::process::exit(1);
}
}
} else {
Expand Down
3 changes: 0 additions & 3 deletions src/rendezvous_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1174,9 +1174,6 @@ impl RendezvousServer {
let mut tmp = [0u8; sign::SECRETKEYBYTES];
tmp[..].copy_from_slice(&sk);
out_sk = Some(sign::SecretKey(tmp));
} else {
log::error!("Malformed private key");
std::process::exit(1);
}
}

Expand Down

0 comments on commit 94ae514

Please sign in to comment.