4
這裏是我的代碼RSA公鑰出口
KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
KeyPair myPair = kpg.generateKeyPair();
PrivateKey k = myPair.getPrivate();
System.out.print(k.serialVersionUID);
Cipher c = Cipher.getInstance("RSA");
c.init(Cipher.ENCRYPT_MODE, myPair.getPublic());
String myMessage = new String("Testing the message");
byte[] bytes = c.doFinal(myMessage.getBytes());
String tt = new String(bytes);
System.out.println(tt);
Cipher d = Cipher.getInstance("RSA");
d.init(Cipher.DECRYPT_MODE, myPair.getPrivate());
byte[] temp = d.doFinal(bytes);
String tst = new String(temp);
System.out.println(tst);
我的問題是如何獲得的公鑰和存儲在別處
這就是我一直在尋找 – 2010-05-06 23:45:26