AES 字段加密迁配置并兼容旧密文

移除字段加密硬编码主密钥,改为 FIELD_ENCRYPTION_KEY 注入。

保留 FIELD_ENCRYPTION_LEGACY_KEY 透明回退旧密文,新写入统一使用主密钥;生产环境校验主密钥和 legacy 密钥长度、占位符及相等关系,并统一生产环境判断口径。

补充配置与旧密文兼容回归测试。
This commit is contained in:
yml
2026-06-14 17:53:24 +08:00
parent 64f7ed3753
commit 8fef037be3
15 changed files with 519 additions and 82 deletions
+1 -1
View File
@@ -128,7 +128,7 @@ func newPaymentConfigRepositoryForJobs(cfg config.Config, db *gorm.DB, logger *z
}
}
if encryptor == nil {
if cfg.AppEnv == "production" {
if config.IsProductionEnv(cfg.AppEnv) {
logger.Fatal("PAYMENT_CONFIG_ENCRYPTION_KEY not set or invalid")
}
encryptor = &paymentconfig.MockEncryptor{}