I want to cast an string to key type.
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);
needs publickey
of a type with the interface Key
.
So how do I cast string to key?
使用KeyFactory基于KeySpec创建所需的密钥。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.