feat(ssh): implement AES-256-CTR encryption
Some checks failed
Test / build (push) Has been cancelled
Test / test (push) Has been cancelled

SSH加密实现(cipher.rs):

实现内容:
1. cipher crate集成(添加cipher = "0.4"依赖)
2. AES-256-CTR加密/解密实现
   - encrypt_packet(): 使用KeyIvInit + StreamCipher trait
   - decrypt_packet(): CTR模式双向加密
   - 添加IV参数支持

3. SSH packet格式优化
   - Random padding生成(rand::thread_rng)
   - MAC计算包含packet_length
   - EncryptedPacket::new()添加IV参数

技术实现:
- 使用cipher::KeyIvInit trait初始化AES-CTR
- 使用cipher::StreamCipher trait的apply_keystream()
- 符合RFC 4253加密packet格式标准

编译结果:
-  编译成功(147 warnings, 0 errors)
-  AES-CTR加密API正确实现
- ⏸️ 加密packet集成待server.rs集成

下一步:
- 在server.rs中集成EncryptedPacket
- 实现IV初始化(从会话密钥派生)
- 测试完整加密通道

依赖变更:
- markbase-core/Cargo.toml: cipher = "0.4"
This commit is contained in:
Warren
2026-06-13 20:19:25 +08:00
parent 66f38698f5
commit 0f32ebce45
3 changed files with 31 additions and 31 deletions

View File

@@ -55,6 +55,7 @@ x25519-dalek = "2.0"
ed25519-dalek = { version = "2.0", features = ["rand_core"] }
aes = "0.8"
ctr = "0.9"
cipher = "0.4"
[features]
default = [] # 默认不启用可选格式