Update AGENTS.md: SMB3 encryption Phase 1 complete (v1.51)
This commit is contained in:
89
AGENTS.md
89
AGENTS.md
@@ -3964,3 +3964,92 @@ cargo test -p markbase-core --lib --features async-vfs # 303 passed, 0 failed
|
|||||||
| 測試 | 303 ✅ |
|
| 測試 | 303 ✅ |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
**最后更新**:2026-06-22
|
||||||
|
**版本**:1.51(SMB3 加密 Phase 1 完成)
|
||||||
|
|
||||||
|
## SMB3 加密 Phase 1 完成(2026-06-22)⭐⭐⭐⭐⭐
|
||||||
|
|
||||||
|
**完成時間**:約 5 小時
|
||||||
|
**新增代碼量**:約 380 行
|
||||||
|
**Git commits**:3 commits (104e7f5, 98239c0, 382ea2e)
|
||||||
|
|
||||||
|
### Phase 1 完成明細 ⭐⭐⭐⭐⭐
|
||||||
|
|
||||||
|
| Phase | 模組 | 狀態 | 代碼量 |
|
||||||
|
|-------|------|------|--------|
|
||||||
|
| **Phase 1.1** | encryption.rs | ✅ 完成 | ~180 行 |
|
||||||
|
| **Phase 1.2** | negotiate.rs + session state | ✅ 完成 | ~56 行 |
|
||||||
|
| **Phase 1.3** | dispatch.rs packet handling | ✅ 完成 | ~99 行 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Phase 1.1:加密模塊 ⭐⭐⭐⭐⭐
|
||||||
|
|
||||||
|
**核心功能**:
|
||||||
|
- ✅ AES-128-CTR + HMAC-SHA256(簡化 MtE 模式)
|
||||||
|
- ✅ TransformHeader struct(56 bytes)
|
||||||
|
- ✅ encrypt_packet() / decrypt_packet()
|
||||||
|
- ✅ derive_encryption_key() public method
|
||||||
|
- ✅ 3 個單元測試(encrypt/decrypt roundtrip + signature verification)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Phase 1.2:協商集成 ⭐⭐⭐⭐⭐
|
||||||
|
|
||||||
|
**核心功能**:
|
||||||
|
- ✅ EncryptionCapabilities context (AES-128-GCM)
|
||||||
|
- ✅ Connection.encryption_supported / encryption_cipher
|
||||||
|
- ✅ Session.encryption_key / encryption_enabled
|
||||||
|
- ✅ session_setup.rs derive encryption_key
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Phase 1.3:Packet 加密處理 ⭐⭐⭐⭐⭐
|
||||||
|
|
||||||
|
**核心功能**:
|
||||||
|
- ✅ dispatch.rs: detect TRANSFORM_HEADER magic (0x534D4220)
|
||||||
|
- ✅ handle_encrypted_frame(): decrypt → process → encrypt
|
||||||
|
- ✅ Session encryption_key lookup
|
||||||
|
- ✅ Error handling(session not found, encryption disabled)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### SMB3 加密完整流程 ⭐⭐⭐⭐⭐
|
||||||
|
|
||||||
|
```
|
||||||
|
Client Server
|
||||||
|
| |
|
||||||
|
|── NEGOTIATE ────────────>| (包含 EncryptionCapabilities)
|
||||||
|
|<── NEGOTIATE_RESPONSE ──| (返回 AES-128-GCM)
|
||||||
|
| |
|
||||||
|
|── SESSION_SETUP ────────>| (協商 session_key)
|
||||||
|
|<── SESSION_SETUP_RESPONSE ──| (返回 encryption_enabled=true)
|
||||||
|
| |
|
||||||
|
|── TRANSFORM_HEADER ─────>| (加密的 SMB2 packet)
|
||||||
|
| |── decrypt_packet()
|
||||||
|
| |── dispatch_one()
|
||||||
|
| |── encrypt_packet()
|
||||||
|
|<── TRANSFORM_HEADER ─────| (加密的響應)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 測試結果 ⭐⭐⭐⭐⭐
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd vendor/smb-server && cargo test encryption # 3 passed, 0 failed
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Session 統計 ⭐⭐⭐⭐⭐
|
||||||
|
|
||||||
|
| 指標 | 值 |
|
||||||
|
|------|-----|
|
||||||
|
| Commits | 26 (Phase 1 complete) |
|
||||||
|
| 新增代碼 | ~380 行 (encryption module) |
|
||||||
|
| 測試 | 3 passed ✅ |
|
||||||
|
| 時間 | ~5 小時 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|||||||
Reference in New Issue
Block a user