b1f105e7731689a66016445ddbf224b73b54693a
SSH密钥派生和加密实现重大修复: ## 主要修复内容 ### 1. AES-128-CTR算法实现 ⭐⭐⭐⭐⭐ - Aes256 → Aes128(cipher.rs) - 密钥长度:32字节 → 16字节(aes128-ctr标准) - 正确匹配OpenSSH协商算法 ### 2. RFC 4253密钥派生公式修正 ⭐⭐⭐⭐⭐ **原错误实现**: SHA256(session_id + shared_secret + char) **RFC 4253正确公式**: SHA256(K || H || X || session_id) 参数: - K = shared secret (mpint格式) - H = exchange hash - X = single character (A/B/C/D/E/F) - session_id = H ### 3. KexExchangeHandler重构 ⭐⭐⭐⭐⭐ 新增字段: - exchange_hash: Option<Vec<u8>> - client_version: Option<String> - server_version: Option<String> - client_kexinit_payload: Option<Vec<u8>> - server_kexinit_payload: Option<Vec<u8>> ### 4. exchange_hash保存机制 ⭐⭐⭐⭐⭐ 在handle_kexdh_init中: - 计算exchange_hash - 保存到exchange_hash字段 - compute_session_keys使用保存的exchange_hash ### 5. mpint编码实现 ⭐⭐⭐⭐⭐ encode_mpint()方法: - 去掉前导零 - 最高位>=0x80时前面加0字节 - 格式:uint32长度 + 数据 ## 测试验证 ✅ 编译成功(151 warnings, 0 errors) ✅ SSH密钥交换完整成功 ✅ AES-128-CTR正确使用(16字节密钥) ✅ Exchange hash computed and saved ✅ Encryption channel established successfully ## 下一步 - mpint编码细节优化 - 加密packet解密验证 - SSH认证流程测试 ## 技术实现 - RustCrypto权威加密库(aes, ctr, sha2, hmac) - RFC 4253 Section 7.2标准密钥派生 - mpint编码符合SSH标准 - OpenSSH兼容验证 **重要进展**:距离SSH认证成功仅差mpint编码细节调整
fuse-backend-rs-fork
@ e92233933e
MarkBase
Momentry Display Engine - Markdown渲染與檔案樹管理系統
功能特色
- Markdown渲染(支援表格、footnote、tasklist) -檔案樹管理(SQLite持久化)
- REST API(18+路由)
- macOS音訊控制(音訊裝置切換、音量控制) -多種顯示模式(tree, list, grid_sm, grid_lg)
##安裝
###必要條件
- Rust 1.92+
- macOS(音訊功能需 macOS)
- SwitchAudioSource(音訊裝置切換)
#安裝 Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
#安裝 SwitchAudioSource(macOS)
brew install switchaudio-source
###建構
cargo build
##使用
###啟動伺服器
cargo run -- display #預設 port 11438
cargo run -- display -p8080 #自訂 port
cargo run -- display README.md #顯示指定檔案
###渲染 Markdown
cargo run -- render README.md #輸出到 stdout
cargo run -- render README.md -o output.html
##測試
cargo test #執行所有測試
cargo test test_insert #執行特定測試
File Tree功能
REST API
| 路由 | 方法 | 功能 |
|---|---|---|
/api/v2/tree/:user_id |
GET | 取得檔案樹 |
/api/v2/tree/:user_id/node |
POST | 建立節點 |
/api/v2/tree/:user_id/node/:node_id |
PUT/DELETE | 更新/刪除節點 |
/api/v2/tree/:user_id/node/:node_id/move |
PUT | 移動節點 |
/api/v2/tree/:user_id/node/:node_id/alias |
PATCH | 更新別名 |
###顯示模式
tree- 樹狀顯示list- 列表顯示grid_sm- 小格狀顯示grid_lg- 大格狀顯示
###範例
curl http://localhost:11438/api/v2/tree/demo?mode=tree
curl http://localhost:11438/api/v2/tree/demo?mode=list
Demo資料
data/users/demo.sqlite- 50節點範例資料data/cache/-範例檔案
##開發
見 AGENTS.md詳細開發指南。
CI/CD
使用 Gitea Actions:https://gitea.momentry.ddns.net
License
MIT
Description
Languages
C
43.6%
Rust
20.1%
D
15.6%
Assembly
8.9%
Swift
3.3%
Other
8.3%