Diffie-Hellman 在 BouncyCastle 中设置生成器参数
我想生成 PKCS #3 中定义的新 DH 参数:
DHParameter ::= SEQUENCE {
prime INTEGER, -- p
base INTEGER, -- g
privateValueLength INTEGER OPTIONAL
}
使用 BouncyCastle。我当前的代码
DHParametersGenerator generator = new DHParametersGenerator();
generator.init(2048, DEFAULT_PRIME_CERTAINTY, new SecureRandom());
DHParameters params = generator.generateParameters();
工作正常,但除了修改库之外,我看不到自己设置 base 的方法。我缺少一些解决方法吗?
提前致谢。
I want to generate new DH parameter as defined in PKCS #3:
DHParameter ::= SEQUENCE {
prime INTEGER, -- p
base INTEGER, -- g
privateValueLength INTEGER OPTIONAL
}
using BouncyCastle. My current code
DHParametersGenerator generator = new DHParametersGenerator();
generator.init(2048, DEFAULT_PRIME_CERTAINTY, new SecureRandom());
DHParameters params = generator.generateParameters();
works fine, but I can't see a way to set the base on my own other than modifying the library. Is there some workaround I am missing?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
实际上,大多数 DH 实现都使用预定义的基值,因此如果不修改源就无法做到这一点。
Actually, most DH implementations uses predefined base value, so it can be no way for doing that without sources modifications.
实际上,您可以使用相同的类来设置您选择的基础。所以你的代码将变成:-
Actually you can set the base of your choice using the same class. So your code will become:-