/** * 輸入流 * */ InputStream is1 = so.getInputStream(); Scanner sc=new Scanner(is1); String str=sc.nextLine(); //對接收的消息進行解密 RSAPrivateKey priKey = rsa.getRSAPrivateKey(); ? ? ?? ? ? ? ? ? String msg= new String((rsa.decrypt(priKey, base64.decode(str)))); System.err.println("密文為"+str); System.err.println(msg); System.out.println("客戶端說:"+rsa.decrypt(priKey, base64.decode(str)));
1 回答

慕粉3167948
TA貢獻10條經(jīng)驗 獲得超5個贊
首先確保你從socket中取出的數(shù)據(jù)是正確的,沒有粘包等情況出現(xiàn),其次,確定好你的RSA加密和解密算法正常,可以在一個項目里面加密一段數(shù)據(jù),然后解密,來判斷RSA加密解密是否正常,只有這兩種情況
添加回答
舉報
0/150
提交
取消