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私钥解密:
System.out.println("公钥加密——私钥解密");
System.out.println("加密前数据的内容是-->" + sourceStr);
byte[] data = sourceStr.getBytes();
byte[] encryptData = RSAUtils.encryptByPublicKey(data, publicKey);
System.out.println("加密后的数据内容是-->" + new String(encryptData));
byte[] decryptData = RSAUtils.decryptByPrivateKey(encryptData,
privateKey);
System.out.println("解密后的数据内容是-->" + new String(decryptData));
公钥加密——私钥解密
加密前数据的内容是-->这是一段待加密的数据
加密后的数据内容是-->(���%5 [�͖W��uA- ��m�u�&w�2��gQ���-5�Q���`7:Й�C,�8t�qM�gJ��e2"�)y��͓����� �Y��@�y*_�M�����x*;�f1���v֚�@�h�}P?X�2
解密后的数据内容是-->这是一段待加密的数据
PHP-RSA加密跨域通讯实战
使用Python的OpenSSL库来进行RSA加密