summaryrefslogtreecommitdiff
path: root/crates/utils/tcp_connection/src
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2025-11-03 20:01:02 +0800
committerGitHub <noreply@github.com>2025-11-03 20:01:02 +0800
commitf58fcaed4d7da4aa23e8500fb4720836378c3440 (patch)
tree0fd0dae1bdc1602a82395b2c11660f80c95f1b20 /crates/utils/tcp_connection/src
parentffb5805291343ba1cd4bb4f38788d9ce6e3e2ba6 (diff)
parentcf2402fff1632fd673a1865d83cefc80b75ed85f (diff)
Merge pull request #34 from JustEnoughVCS/jvcs_dev_actions
Jvcs dev actions
Diffstat (limited to 'crates/utils/tcp_connection/src')
-rw-r--r--crates/utils/tcp_connection/src/instance_challenge.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/utils/tcp_connection/src/instance_challenge.rs b/crates/utils/tcp_connection/src/instance_challenge.rs
index c4ea6a8..3a7f6a3 100644
--- a/crates/utils/tcp_connection/src/instance_challenge.rs
+++ b/crates/utils/tcp_connection/src/instance_challenge.rs
@@ -132,7 +132,21 @@ impl ConnectionInstance {
self.stream.read_exact(&mut challenge).await?;
// Load private key
- let private_key_pem = tokio::fs::read_to_string(&private_key_file).await?;
+ let private_key_pem = tokio::fs::read_to_string(&private_key_file)
+ .await
+ .map_err(|e| {
+ TcpTargetError::NotFound(format!(
+ "Read private key \"{}\" failed: \"{}\"",
+ private_key_file
+ .as_ref()
+ .display()
+ .to_string()
+ .split("/")
+ .last()
+ .unwrap_or("UNKNOWN"),
+ e
+ ))
+ })?;
// Sign the challenge with supported key types
let signature = if let Ok(rsa_key) = RsaPrivateKey::from_pkcs1_pem(&private_key_pem) {