빌드 환경 설정 및 kjb-safedb 연동 조정
- build.gradle: nexus 저장소 및 의존성 설정 정리
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package kjb.safedb;
|
||||
|
||||
import com.eactive.ext.kjb.safedb.KjbSafedbWrapper;
|
||||
import com.eactive.ext.kjb.safedb.SafeDBColumns;
|
||||
import com.eactive.ext.kjb.safedb.Utils;
|
||||
//import com.eactive.ext.kjb.safedb.KjbSafedbWrapper;
|
||||
//import com.eactive.ext.kjb.safedb.SafeDBColumns;
|
||||
//import com.eactive.ext.kjb.safedb.Utils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
@@ -25,26 +25,26 @@ public class KjbNotRnnoJpaAttributeConverter implements AttributeConverter<Strin
|
||||
public String convertToDatabaseColumn(String attribute) {
|
||||
// log.debug("DB 암호화 #1 - {} / {}", attribute, SafeDBColumns.NOT_RNNO);
|
||||
|
||||
String originalAttribute = attribute;
|
||||
if (StringUtils.isNotEmpty(attribute)) {
|
||||
KjbSafedbWrapper wrapper = KjbSafedbWrapper.getInstance();
|
||||
attribute = wrapper.encryptNotRnnoString(attribute);
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
// 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();
|
||||
log.debug("DB 암호화 #2 : {} -> {}", originalAttribute, attribute);
|
||||
}
|
||||
}
|
||||
// String originalAttribute = attribute;
|
||||
// if (StringUtils.isNotEmpty(attribute)) {
|
||||
// KjbSafedbWrapper wrapper = KjbSafedbWrapper.getInstance();
|
||||
// attribute = wrapper.encryptNotRnnoString(attribute);
|
||||
//
|
||||
// if (log.isDebugEnabled()) {
|
||||
// // 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();
|
||||
// log.debug("DB 암호화 #2 : {} -> {}", originalAttribute, attribute);
|
||||
// }
|
||||
// }
|
||||
|
||||
return attribute;
|
||||
}
|
||||
@@ -59,23 +59,23 @@ public class KjbNotRnnoJpaAttributeConverter implements AttributeConverter<Strin
|
||||
public String convertToEntityAttribute(String dbData) {
|
||||
// log.debug("DB 복호화 #1 - {} / {}", dbData, SafeDBColumns.NOT_RNNO);
|
||||
|
||||
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) + "...";
|
||||
log.warn("DB 복호화 실패: 복호화하지 않고 원본 반환. dbData={} (Length : {})", logData, dbData.length());
|
||||
needFixLogger.warn("DB 복호화 실패: 복호화하지 않고 원본 반환. dbData={} (Length : {})", logData, dbData.length(), e);
|
||||
return dbData;
|
||||
}
|
||||
} else {
|
||||
log.debug("DB 복호화 경고: Base64 형식이 아님. 복호화하지 않고 원본 반환. dbData={}", 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) + "...";
|
||||
// log.warn("DB 복호화 실패: 복호화하지 않고 원본 반환. dbData={} (Length : {})", logData, dbData.length());
|
||||
// needFixLogger.warn("DB 복호화 실패: 복호화하지 않고 원본 반환. dbData={} (Length : {})", logData, dbData.length(), e);
|
||||
// return dbData;
|
||||
// }
|
||||
// } else {
|
||||
// log.debug("DB 복호화 경고: Base64 형식이 아님. 복호화하지 않고 원본 반환. dbData={}", dbData);
|
||||
// }
|
||||
// }
|
||||
|
||||
// log.debug("DB 복호화 #2 : {} -> {}", dbDataOriginal, dbData);
|
||||
|
||||
@@ -88,28 +88,29 @@ public class KjbNotRnnoJpaAttributeConverter implements AttributeConverter<Strin
|
||||
* @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;
|
||||
// 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;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user