如何使用 modInverse 恢复 modPow 的初始 bigInteger

问题描述 投票:0回答:1

我正在尝试在java中使用

modInverse
来获取biginteger的原始值。假设我们有一个输入:

a = bigIntegerSample.modPow(exponent, RSA_MOD);

如何获取 bigIntegerSample 的值?我知道指数和 RSA_MOD。

我试过:

bigIntegerSample = a.modInverse(RSA_MOD);

但这是错误的。有什么提示吗?

java biginteger
1个回答
0
投票

a.modInverse(RSA_MOD)
给你
a
的乘法逆。简直是
(a.modInverse(RSA_MOD) * a) % RSA_MOD == 1
。那对你没有多大帮助。

您基本上期待离散对数问题的解决方案。密码学基于没有简单解决方案的假设。你已经加密了你的密文,你想在没有密钥的情况下解密它。如果你不知道密钥,这将很困难......但如果你知道密钥,你就可以做到

BigInteger b = a.modPow(secretKey, RSA_MOD);

现在希望

bigIntegerSample == b
。这就是@President James K. Polk 告诉你的。

© www.soinside.com 2019 - 2024. All rights reserved.