Add build_kexdh_reply logging to verify server_public_key
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled

验证server_public_key一致性:
- build_kexdh_reply输入:[156, 109, 160, 110, ...]
- crypto.rs中的值:[156, 109, 160, 110, ...]
- 完全一致 ✓

Packet capture验证:
- Client public key:d9a035145879e1c6...(与server logs完全匹配)
- Server public key:9c6da06e74b7e55c...(与server logs完全匹配)

关键发现:
- 所有public keys完全匹配
- Client计算的shared_secret ≠ Server(仍需调查)

下一步:
继续调查shared secret encoding差异
This commit is contained in:
Warren
2026-06-14 21:28:49 +08:00
parent db28c05964
commit bc9414d4da
2 changed files with 5 additions and 0 deletions

Binary file not shown.

View File

@@ -125,6 +125,9 @@ impl KexExchangeHandler {
host_key_blob: &[u8],
server_public_key: &[u8],
) -> Result<SshPacket> {
info!("=== Building SSH_MSG_KEXDH_REPLY ===");
info!("Input server_public_key: {:?}", server_public_key);
let mut payload = Vec::new();
payload.write_u8(PacketType::SSH_MSG_KEXDH_REPLY as u8)?;
@@ -132,6 +135,7 @@ impl KexExchangeHandler {
payload.write_u32::<BigEndian>(host_key_blob.len() as u32)?;
payload.write_all(host_key_blob)?;
info!("Writing server_public_key to payload (32 bytes)");
payload.write_u32::<BigEndian>(32)?;
payload.write_all(server_public_key)?;
@@ -139,6 +143,7 @@ impl KexExchangeHandler {
payload.write_u32::<BigEndian>(signature.len() as u32)?;
payload.write_all(&signature)?;
info!("SSH_MSG_KEXDH_REPLY payload built successfully");
Ok(SshPacket::new(payload))
}