system微服务util单元测试完善

This commit is contained in:
gaoqr
2025-12-12 14:51:35 +08:00
parent 3d0e42f4eb
commit 26cfc538ae
8 changed files with 1022 additions and 17 deletions
@@ -80,23 +80,23 @@ public class AsymmetricAlgorithmUtil {
return keys;
}
public static void main(String[] args) {
LinkedList<String> priKeyAndPubKey = AsymmetricAlgorithmUtil.getPriKeyAndPubKey();
String privateKey = priKeyAndPubKey.get(0);
String publicKey = priKeyAndPubKey.get(1);
String text = "HelloWorld";
String encryptByPublic = AsymmetricAlgorithmUtil.encryptByPublic(text, publicKey);
System.out.println(encryptByPublic);
String s = AsymmetricAlgorithmUtil.decryptByPrivate(encryptByPublic, privateKey);
System.out.println("公钥加密私钥解密:"+s);
String encryptByPrivate = AsymmetricAlgorithmUtil.encryptByPrivate(text, privateKey);
System.out.println(encryptByPrivate);
String s1 = AsymmetricAlgorithmUtil.decryptByPublic(encryptByPrivate,publicKey);
System.out.println("私钥加密公钥解密:"+s1);
}
// public static void main(String[] args) {
//
// LinkedList<String> priKeyAndPubKey = AsymmetricAlgorithmUtil.getPriKeyAndPubKey();
// String privateKey = priKeyAndPubKey.get(0);
// String publicKey = priKeyAndPubKey.get(1);
// String text = "HelloWorld";
//
// String encryptByPublic = AsymmetricAlgorithmUtil.encryptByPublic(text, publicKey);
// System.out.println(encryptByPublic);
// String s = AsymmetricAlgorithmUtil.decryptByPrivate(encryptByPublic, privateKey);
// System.out.println("公钥加密私钥解密:"+s);
//
// String encryptByPrivate = AsymmetricAlgorithmUtil.encryptByPrivate(text, privateKey);
// System.out.println(encryptByPrivate);
// String s1 = AsymmetricAlgorithmUtil.decryptByPublic(encryptByPrivate,publicKey);
// System.out.println("私钥加密公钥解密:"+s1);
// }
}