개발서버에 push위해

This commit is contained in:
jaewohong
2025-11-19 15:59:34 +09:00
parent 63561457d2
commit c2ead22583
8 changed files with 429 additions and 63 deletions
@@ -57,6 +57,10 @@ import com.eactive.eai.transformer.transform.Transform;
import com.eactive.eai.transformer.transform.TransformManager;
import com.eactive.eai.util.HexaConverter;
import com.ext.eai.common.stdmessage.STDMessageKeys;
// safeDB
import com.eactive.ext.kjb.safedb.KjbSafedbWrapper;
import com.eactive.ext.kjb.safedb.Utils;
// until here
@Service
@@ -452,6 +456,7 @@ public class EAILogDAO {
}
// 암호화
/*
Charset hexaCharset = Charset.forName("euc-kr");
if ("Y".equalsIgnoreCase(EncryptionManager.getInstance().getEncryptYN())) {
try {
@@ -471,20 +476,22 @@ public class EAILogDAO {
}
} else {
biz = bizMsgStr;
}
}
*/
// jwhong safeDB 암호화
/*
if ("Y".equalsIgnoreCase(EncryptionManager.getInstance().getEncryptYN())) {
try {
biz = EncryptSafeDb(bizMsgStr);
} catch (Exception e) {
logger.error("EAIFileLogger] bizMsgStr encryption Error - " + e.getMessage());
biz = bizMsgStr;
}
} else {
biz = bizMsgStr;
}
*/
// jwhong safeDB end
// 임시코드 시작
@@ -855,12 +862,121 @@ public class EAILogDAO {
return false;
}
private String EncryptSafeDb(String attribute) {
String originalAttribute = attribute;
if (StringUtils.isNotEmpty(attribute)) {
KjbSafedbWrapper wrapper = KjbSafedbWrapper.getInstance();
attribute = wrapper.encryptNotRnnoString(attribute);
if (logger.isInfo()) {
// originalAttribute 홀수 글자 마스킹
StringBuilder sb = new StringBuilder();
for (int i = 0; i < originalAttribute.length(); i++) {
if (i % 2 == 0) {
sb.append(originalAttribute.charAt(i));
} else {
sb.append("*");
}
}
originalAttribute = sb.toString();
System.out.println("DB 암호화 #2 : {"+ originalAttribute +"} -> {"+attribute+"}");
//logger.debug("DB 암호화 #2 : {} -> {}", originalAttribute, attribute);
}
}
return attribute;
}
public String DecryptSafeDb(String dbData) {
String dbDataOriginal = dbData;
if (StringUtils.isNotEmpty(dbData)) {
if (this.isEncrypted(dbData)) {
KjbSafedbWrapper safeDBWrapper = KjbSafedbWrapper.getInstance();
try {
dbData = safeDBWrapper.decryptNotRnno(dbData);
} catch (Exception e) {
// 복호화 실패시 원본 반환
String logData = dbData.length() <= 3 ? dbData : dbData.substring(0, 3) + "...";
logger.warn("DB 복호화 실패: 복호화하지 않고 원본 반환. dbData={} (Length : {})", logData, dbData.length());
return dbData;
}
} else {
logger.debug("DB 복호화 경고: Base64 형식이 아님. 복호화하지 않고 원본 반환. dbData={}", dbData);
}
}
//logger.debug("DB 복호화 #2 : {} -> {}", dbDataOriginal, dbData);
return dbData;
}
/**
* 암호화 여부 확인(base64 인코딩 여부로 판단, 또는 0-9, - 로 구성된 경우 암호화 되지 않은 걸로 판단(연락처))
* @param data
* @return
*/
private boolean isEncrypted(String data) {
if (StringUtils.isEmpty(data)) {
return false;
}
// 숫자, - 로만 구성된 경우 암호화 되지 않은 걸로 판단 (ex: 연락처)
if (data.matches("^[0-9-]+$")) {
return false;
}
data = data.trim();
// Base64 형식 체크
if (!Utils.isBase64(data)) {
return false;
}
// Base64 길이 체크 (4의 배수)
if (data.length() % 4 != 0) {
return false;
}
return true;
}
/*
private String EncryptSafeDb(String msg) {
PropManager propManager = PropManager.getInstance();
String safeDbPath = propManager.getProperty("SafeDB","safedb.path");
return "this is a message";
SimpleSafeDB safedb = SimpleSafeDB.getInstance();
boolean loginResult = false;
if(!safedb.login()) {
loginResult = safedb.getSafeDBConfigMgr().isLoginCheck();
}
String userName = "SAFEDB";
String tableName = "SAFEDB.POLICY";
String columnName1 = "bzwkdatactnt";
byte[] byteMsg = msg.getBytes(StandardCharsets.UTF_8);
byte[] encryptedBytes1 = null;
try {
encryptedBytes1 = safedb.encrypt(userName, tableName, columnName1, byteMsg);
System.out.println("Encrypted Data : [" + new String(encryptedBytes1) + "]");
byte[] decryptedBytes1 = safedb.decrypt(userName, tableName, columnName1, encryptedBytes1);
} catch (SafeDBSDKException e) {
e.printStackTrace();
}
String encryptedMsg = new String(encryptedBytes1, StandardCharsets.UTF_8);
return encryptedMsg;
}
*/
}
@@ -69,6 +69,7 @@ public class JMSSender {
throw new Exception("qconFactory not found -" + connectionFactory);
queue = locator.getQueue(destination);
logger.info("resolved quene name is:" + "["+ queue + "]");
qsender = qsession.createSender(queue);
ObjectMessage msg = qsession.createObjectMessage();