算法总结
enkzip 格式:<nonce_b64url>.<ciphertext+tag_b64url>,其中两部分都使用 base64url(无填充)编码。
加解密流程(Enigma.b.a / Enigma.b.b):
- 取 user_id:从 Authorization: Bearer 的 JWT payload 中读取 _id(24 位 ObjectId hex),见 libenigmaa.so.c:8958 中的 JWT 解析。
- 派生 AES 密钥:将 user_id 左旋 13 字节 → user_id[13:] + user_id[:13],对其做 MD5,把 16 字节摘要转成 32 位小写 hex,再以 ASCII 字节序列作为 AES‑256 密钥(32 字节)。libenigmaa.so.c:6693 中的反编译用 MD5 初值(0x67452301/0xefcdab89/0x98badcfe/0x10325476)和最后一个块拼接 param_2[0:8] + param_2[5:13] 到 offset 11/16,正好把原 _id 旋转成上述形式。
- AES‑256‑GCM:12 字节 nonce、空 AAD、16 字节 tag。libenigmaa.so.c:8025/8347 是 J0 = nonce‖0x00000001、E_K(J0) 做 tag mask 的标准 GCM。