我正在 Java 中实现 RSA 我遇到了下面给出的代码,它在解密明文后以数字形式显示明文,但我想要我输入的简单英语。我不想使用java api。
测试Rsa.Java
import java.io.IOException;
import java.math.BigInteger;
import java.util.Random;
public class TestRsa {
private BigInteger p, q;
private BigInteger n;
private BigInteger PhiN;
private BigInteger e, d;
public TestRsa() {
initialize();
}
public void initialize() {
int SIZE = 512;
/* Step 1: Select two large prime numbers. Say p and q. */
p = new BigInteger(SIZE, 15, new Random());
q = new BigInteger(SIZE, 15, new Random());
/* Step 2: Calculate n = p.q */
n …Run Code Online (Sandbox Code Playgroud)