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"
70 lines
2.0 KiB
TOML
70 lines
2.0 KiB
TOML
[package]
|
||
name = "markbase-core"
|
||
version = "0.2.0"
|
||
edition = "2021"
|
||
|
||
[dependencies]
|
||
# === 核心压缩库(Phase 1-2已完成)===
|
||
zip = "0.6" # ZIP格式(稳定版本)
|
||
tar = "0.4.46" # TAR格式
|
||
flate2 = "1.1" # GZIP格式(已有)
|
||
tempfile = "3.12" # 临时目录(解压时需要)
|
||
|
||
# === 可选压缩库(Phase 3,争议格式)===
|
||
unrar = { version = "0.4.0", optional = true } # RAR解压 ⚠️法律风险
|
||
xz2 = { version = "0.1.7", optional = true } # XZ格式 ⚠️外部依赖
|
||
sevenz-rust = { version = "0.6.1", optional = true } # 7z格式 ⚠️库不稳定(修正版本号)
|
||
|
||
anyhow = "1"
|
||
axum = { version = "0.7", features = ["macros"] }
|
||
bcrypt = "0.16"
|
||
chrono = { version = "0.4", features = ["serde"] }
|
||
regex = "1"
|
||
clap = { version = "4", features = ["derive"] }
|
||
dav-server = "0.11"
|
||
filetree = { path = "../filetree" }
|
||
futures-util = "0.3"
|
||
log = "0.4"
|
||
env_logger = "0.11"
|
||
markbase-webdav = { path = "../markbase-webdav" }
|
||
pulldown-cmark = "0.12"
|
||
rusqlite = { version = "0.32", features = ["bundled"] }
|
||
sled = "1.0.0-alpha.124"
|
||
serde = { version = "1", features = ["derive"] }
|
||
serde_json = "1"
|
||
sha2 = "0.10"
|
||
hmac = "0.12"
|
||
base64 = "0.22"
|
||
tokio = { version = "1", features = ["full"] }
|
||
tokio-postgres = "0.7"
|
||
russh = "0.61.2"
|
||
russh-keys = "0.50.0-beta.7"
|
||
russh-sftp = "2.3.0"
|
||
ssh2 = "0.9.4"
|
||
ssh-key = "0.7.0-rc.10"
|
||
rand = "0.8"
|
||
axum-extra = { version = "0.9", features = ["multipart"] }
|
||
tokio-util = { version = "0.7", features = ["io"] }
|
||
toml = "0.8"
|
||
uuid = { version = "1", features = ["v4"] }
|
||
dashmap = "6.1"
|
||
md5 = "0.8"
|
||
adler = "1.0"
|
||
byteorder = "1.5"
|
||
x25519-dalek = "2.0"
|
||
ed25519-dalek = { version = "2.0", features = ["rand_core"] }
|
||
aes = "0.8"
|
||
ctr = "0.9"
|
||
cipher = "0.4"
|
||
|
||
[features]
|
||
default = [] # 默认不启用可选格式
|
||
optional-formats = ["unrar", "xz2", "sevenz-rust"] # 争议格式可选启用
|
||
|
||
[dev-dependencies]
|
||
# tempfile moved to dependencies (needed for archive extraction)
|
||
|
||
[[bin]]
|
||
name = "markbase-core"
|
||
path = "src/main.rs"
|