有没有办法禁用加密,或者可能在 Grails 项目的集成测试期间使用简单的算法?字段级加密有相当多的开销,不一定需要在那时进行测试,只会增加运行测试所需的时间。
在测试阶段排除插件可能不起作用,因为需要映射并且可能会破坏编译。
我在想纯文本或更简单的算法可能会起作用,或者甚至有可能让配置忽略加密处理?
目标只是在测试期间减少插件对性能的影响。
One alternative that could help would be to turn down the keyObtentionIterations in dev (it's a config value). This is the number of iterations that the encryptor does to make it much harder to crack, as it recursively encrypts that many times to slow things down.
Change this in your config:
keyObtentionIterations = 1000
to
keyObtentionIterations = 1
(if you have it set, otherwise add it). That should speed things up significantly and still keep it so that overflow issues are still tested.
If that does help, I'd be curious to hear how much that speeds things up if you could reply with speed differences.
您可以使用 Category 来排除加密。但是您必须衡量哪个是性能命中(类别或加密)。
`类加密类别{
static String decrypt(PBEStringEncryptor obj,String encStr) {
return encStr
}
static String encrypt(PBEStringEncryptor obj,String str) {
return str;
}
}`