diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-11-03 20:01:02 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-03 20:01:02 +0800 |
| commit | f58fcaed4d7da4aa23e8500fb4720836378c3440 (patch) | |
| tree | 0fd0dae1bdc1602a82395b2c11660f80c95f1b20 /crates/utils/tcp_connection | |
| parent | ffb5805291343ba1cd4bb4f38788d9ce6e3e2ba6 (diff) | |
| parent | cf2402fff1632fd673a1865d83cefc80b75ed85f (diff) | |
Merge pull request #34 from JustEnoughVCS/jvcs_dev_actions
Jvcs dev actions
Diffstat (limited to 'crates/utils/tcp_connection')
| -rw-r--r-- | crates/utils/tcp_connection/src/instance_challenge.rs | 16 |
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) { |
