MCPcopy Create free account
hub / github.com/Giyn/LiveChat / privateEncrypt

Method privateEncrypt

src/pers/giyn/LiveChat/server/utils/Utils.java:457–465  ·  view source on GitHub ↗
(byte[] data, RSAPrivateKey privateKey)

Source from the content-addressed store, hash-verified

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 {

Callers 3

filePackMethod · 0.95
friendListPackMethod · 0.95
messagePackMethod · 0.95

Calls 3

rsaSplitCodecMethod · 0.95
initMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected