aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPaolo Asperti <[email protected]>2024-01-31 04:21:00 +0100
committerGitHub <[email protected]>2024-01-31 11:21:00 +0800
commit94ae51458c310aca43e79325e324a3b98a02ab26 (patch)
tree64e9e0939c91d089cb2e990823a33a7c558f4f10
parent778c89efb10f687afe803c2afaed26be6f7e781d (diff)
downloadrustdesk-server-94ae51458c310aca43e79325e324a3b98a02ab26.tar.gz
rustdesk-server-94ae51458c310aca43e79325e324a3b98a02ab26.zip
fix Pk size check (#361)
* more descriptive error * fix key size check
-rw-r--r--src/common.rs3
-rw-r--r--src/rendezvous_server.rs3
2 files changed, 3 insertions, 3 deletions
diff --git a/src/common.rs b/src/common.rs
index 977f8ed..c2c63ba 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -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 {
diff --git a/src/rendezvous_server.rs b/src/rendezvous_server.rs
index ede0ede..0c0d107 100644
--- a/src/rendezvous_server.rs
+++ b/src/rendezvous_server.rs
@@ -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);
}
}