我想将字符串转换为键类型。
BufferedReader br = new BufferedReader(new FileReader(publicKeyFile));
String publicKey = br.readLine();//(Key) keyIn.readObject();
br.close();
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.WRAP_MODE, publicKey);
cipher.init(Cipher.WRAP_MODE, publicKey);
需要具有接口(interface) Key
的类型的 publickey
.
那么如何将字符串转换为键?
最佳答案
使用KeyFactory根据KeySpec创建您需要的Key。
关于java - java中如何将String转换为Key,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23500790/