Skip to content

Commit

Permalink
optimize ConfigToolsTest
Browse files Browse the repository at this point in the history
  • Loading branch information
l81893521 committed Dec 18, 2023
1 parent 52ccf3b commit b53b432
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
21 changes: 0 additions & 21 deletions common/src/main/java/io/seata/common/util/ConfigTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,25 +118,4 @@ public static byte[] base642Byte(String base64Key) {
return Base64.getDecoder().decode(base64Key);
}

public static void main(String[] args) throws Exception {
Scanner scan = new Scanner(System.in);
KeyPair keyPair = getKeyPair();
String publicKeyStr = ConfigTools.getPublicKey(keyPair);
String privateKeyStr = ConfigTools.getPrivateKey(keyPair);
System.out.println("publicKeyStr:\n" + publicKeyStr);
System.out.println("privateKeyStr:\n" + privateKeyStr);
System.out.println(
"after the key is generated, please keep your key pair properly, if you need to encrypt, please enter your database password");
System.out.println("input 'q' exit");
while (scan.hasNextLine()) {
String password = scan.nextLine();
if (StringUtils.isNotBlank(password) && !"q".equalsIgnoreCase(password)) {
String byte2Base64 = ConfigTools.privateEncrypt(password, privateKeyStr);
System.out.println("encryption completed: \n" + byte2Base64);
}
break;
}
scan.close();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
*/
public class ConfigToolsTest {

@Test
public void testInit() {
Assertions.assertNotNull(new ConfigTools());
}

@Test
public void test() throws Exception {
KeyPair keyPair = ConfigTools.getKeyPair();
Expand Down

0 comments on commit b53b432

Please sign in to comment.