(byte[] data, RSAPrivateKey privateKey)
| 455 | } |
| 456 | |
| 457 | public static byte[] privateEncrypt(byte[] data, RSAPrivateKey privateKey) { |
| 458 | try { |
| 459 | Cipher cipher = Cipher.getInstance(RSA_ALGORITHM); |
| 460 | cipher.init(Cipher.ENCRYPT_MODE, privateKey); |
| 461 | return rsaSplitCodec(cipher, Cipher.ENCRYPT_MODE, data, privateKey.getModulus().bitLength()); |
| 462 | } catch (Exception e) { |
| 463 | throw new RuntimeException("加密字符串[" + Arrays.toString(data) + "]时遇到异常", e); |
| 464 | } |
| 465 | } |
| 466 | |
| 467 | public static byte[] publicDecrypt(byte[] data, RSAPublicKey publicKey) { |
| 468 | try { |
no test coverage detected