Interface UserFEKDecryptor
- All Known Implementing Classes:
UserCertDecryptor, UserPasswordDecryptor
public interface UserFEKDecryptor
用户 文件加密密钥 解密器 User File Encrypt Key Decryptor
用于从 UserInfo 中解密出文件加密密钥(FEK)和初始化向量(IV)。
与 UserFEKEncryptor 互为逆操作。
OFD 解密流程中,遍历密钥描述文件中的 UserInfo 列表,
通过 encryptCaseId() 和 getUsername() 匹配对应的解密器,
调用 decrypt(UserInfo) 恢复 FEK 和 IV。
- Since:
- 2.4.0
- Author:
- 权观宇
-
Method Summary
Modifier and TypeMethodDescriptiondecrypt(org.ofdrw.core.crypto.encryt.UserInfo userInfo) 从 UserInfo 中解密出文件加密密钥和初始化向量加密保护方案标识目标用户名
-
Method Details
-
decrypt
DecryptResult decrypt(org.ofdrw.core.crypto.encryt.UserInfo userInfo) throws org.bouncycastle.crypto.CryptoException 从 UserInfo 中解密出文件加密密钥和初始化向量根据加密方案的不同,解密方式也不同:
- 口令加密(EncryptGMPassword):KDF派生KEK → SM4-CBC解密 EncryptedWK → FEK
- 证书加密(EncryptGMCert):SM2私钥解密 C1C3C2密文 → FEK
- Parameters:
userInfo- 加密的用户信息(含被包装的 FEK 和 IV)- Returns:
- 解密结果,包含 FEK 和 IV(均为16字节)
- Throws:
org.bouncycastle.crypto.CryptoException- 解密过程异常(如密钥不匹配、口令错误)
-
encryptCaseId
String encryptCaseId()加密保护方案标识必须与加密时使用的方案标识一致,参见
ProtectionCaseID:- "1.1.1" — 口令加密(EncryptGMPassword)
- "1.1.2" — 证书加密(EncryptGMCert)
解密时用于与密钥描述文件(DecyptSeed)中的 EncryptCaseId 进行匹配。
- Returns:
- 加密保护方案标识
-
getUsername
String getUsername()目标用户名用于与 UserInfo 中的 UserName 进行匹配,定位该用户对应的加密信息。 返回 null 时表示匹配第一个 UserInfo(不按用户名过滤)。
- Returns:
- 目标用户名,可为 null
-