如何在集成测试期间禁用 Grails Jasypt 插件加密?

发布于 2025-01-05 18:32:31 字数 203 浏览 0 评论 0原文

有没有办法禁用加密,或者在 Grails 项目的集成测试期间使用简单的算法?字段级加密中有相当多的开销,不一定需要进行测试,而只是增加了运行测试所需的时间。

在测试阶段排除插件可能不起作用,因为需要映射,并且可能会破坏编译。

我认为纯文本或更简单的算法可能会起作用,或者甚至有可能让配置一起忽略加密处理吗?

目标只是减少测试期间插件的性能影响。

Is there a way to disable encryption, or possibly use a trivial algorithm during integration testing of a Grails project? There is quite a bit of overhead in the field level encryption that doesn't necessarily need to be tested then and simply adds to the time taken to run the tests.

Excluding the plugin during the test phase probably won't work since mapping is required and will likely break the compile.

I'm thinking a plain text or simpler algorithm might work, or would it be possible even to have a config ignore the encryption processing all together?

The goal is simply to reduce the performance hit of the plugin during tests.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

人生戏 2025-01-12 18:32:31

一种可能有帮助的替代方法是关闭 dev 中的 keyObtentionIterations (它是一个配置值)。这是加密器为使其更难破解而执行的迭代次数,因为它会递归加密多次以减慢速度。

在您的配置中将其更改

keyObtentionIterations = 1000

keyObtentionIterations = 1

:(如果您设置了它,否则添加它)。这应该会显着加快速度,并仍然保持速度,以便仍然测试溢出问题。

如果这确实有帮助,我很想知道如果你能以速度差异来回复的话,速度会提高多少。

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.

末骤雨初歇 2025-01-12 18:32:31

您可以使用类别来消除加密。但您必须衡量哪一个是性能命中的(类别或加密)。

`类加密类别 {

static String decrypt(PBEStringEncryptor obj,String encStr) {
    return encStr
}

static String encrypt(PBEStringEncryptor obj,String str) {
    return str;
}

}`

You could use Category to stub out encryption. But you will have to measure which one is a perf hit (Category or Encryption).

`class EncryptionCategory {

static String decrypt(PBEStringEncryptor obj,String encStr) {
    return encStr
}

static String encrypt(PBEStringEncryptor obj,String str) {
    return str;
}

}`

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文