(improvement)(headless) Opt encrypt database password, avoid repeated decryption.(#1326) (#1562)

Co-authored-by: lxwcodemonkey
This commit is contained in:
LXW
2024-08-13 10:10:52 +08:00
committed by GitHub
parent d32d791238
commit 95be7f3ce1
6 changed files with 19 additions and 37 deletions

View File

@@ -46,7 +46,7 @@ public class Database extends RecordInfo {
private List<String> viewers = Lists.newArrayList();
public String passwordDecrypt() {
return AESEncryptionUtil.aesDecryptCBC(password);
return AESEncryptionUtil.aesDecryptECB(password);
}
}

View File

@@ -65,14 +65,13 @@ public class SqlUtils {
}
public SqlUtils init(Database database) {
//todo Password decryption
return SqlUtilsBuilder
.getBuilder()
.withName(database.getId() + AT_SYMBOL + database.getName())
.withType(database.getType())
.withJdbcUrl(database.getUrl())
.withUsername(database.getUsername())
.withPassword(database.passwordDecrypt())
.withPassword(database.getPassword())
.withJdbcDataSource(this.jdbcDataSource)
.withResultLimit(this.resultLimit)
.withIsQueryLogEnable(this.isQueryLogEnable)