我需要创建一个函数,每次调用它时总是可以生成相同的私钥/公钥。
这是我创建的功能代码:
public void generateTheUniqueKeys() {
KeyPairGenerator keyGenerator = KeyPairGenerator.getInstance("RSA");
keyGenerator.initialize(512);
KeyPair keyPair = keyGenerator.generateKeyPair();
// I need every time when this function is called, it generate the same keys as that generated from previous call
PrivateKey privateKey = keyPair.getPrivate();
PublicKey pubKey = keyPair.getPublic();
}
如何使我的函数始终生成相同的密钥对?