소스검증을 위한 수정 변경

This commit is contained in:
kimre
2022-07-12 12:26:45 +09:00
parent 74511fb587
commit 3d7032432c
40 changed files with 2028 additions and 2120 deletions

View File

@@ -408,8 +408,8 @@ public class CustMgtService {
svcUserInfo.setUserSttusCd(Const.USER_STTUS_CD_NOMAL);
svcUserInfo.setCustSeq(custSeq);
svcUserInfo.setUserTpCd(Const.USER_TP_CD_TEST);
svcUserInfo
.setPwd(EncryptionUtil.getCustomSHA512(insertTestIdReqDto.getUserId(), insertTestIdReqDto.getUserPw()));
svcUserInfo.setPrntsUserSeq(userSeq);
svcUserInfo.setPwd(insertTestIdReqDto.getUserPw());
svcUserInfo.setBizrAuthYn(Const.COMM_NO);
svcUserInfo.setLineTpCd(Const.LINE_TP_CD_NORMAL);
svcUserInfo.setHpNo(insertTestIdReqDto.getMdn());
@@ -583,11 +583,10 @@ public class CustMgtService {
String userId = updateUserReqDto.getUserId();
String userPw = updateUserReqDto.getUserPw();
String encPwd = "";
try {
// 패스워드 암호화
encPwd = EncryptionUtil.getCustomSHA512(userId, userPw);
String encPwd = EncryptionUtil.getCustomSHA512(userId, userPw);
updateUserReqDto.setUserPw(encPwd);
// 사용자 정보 수정
@@ -649,7 +648,6 @@ public class CustMgtService {
// DB 처리.
String userId = insertMassUsers.get(j).getUserId();
String imsiPw = RandomStringUtils.randomAlphanumeric(10);
// String encPwd = EncryptionUtil.getCustomSHA512(userId, imsiPw);
SvcUserInfo svcUserInfo2 = new SvcUserInfo();
String userSeq = custMgtMapper.getUserSeq();

View File

@@ -155,7 +155,8 @@ public class LoginService {
String clientKey = DateUtils.date2strYMDHMS() + "AD" + RandomStringUtils.randomAlphanumeric(8);
SendMsgDto sendMsgDto = new SendMsgDto();
sendMsgDto.setClientKey(clientKey);
sendMsgDto.setMsg("인증 번호는 [" + authNum + "] 입니다.");
sendMsgDto.setMsg("[LG U+ 메시지허브이지]\n"
+ "로그인 2차인증 인증번호는 " + authNum + " 입니다.");
sendMsgDto.setPhone(user.getHpNo());
sendMsgDto.setTableName(sendMsgTableName);
loginMapper.insertSendMsg(sendMsgDto);
@@ -255,7 +256,9 @@ public class LoginService {
String clientKey = DateUtils.date2strYMDHMS() + "AD" + RandomStringUtils.randomAlphanumeric(8);
SendMsgDto sendMsgDto = new SendMsgDto();
sendMsgDto.setClientKey(clientKey);
sendMsgDto.setMsg("[U+메시지허브이지] \n임시 비밀번호 안내 : " + randomPw + "\n로그인 후, 비밀번호 변경해주세요.\n");
sendMsgDto.setMsg("[LG U+] 메시지허브이지 임시 비밀번호 안내\n"
+ "임시 비밀번호 " + randomPw + "\n"
+ "※ 임시 비밀번호로 로그인한 후 보안을 위해 비밀번호를 반드시 변경해 주세요.");
sendMsgDto.setPhone(user.getHpNo());
sendMsgDto.setTableName(sendMsgTableName);
loginMapper.insertSendMsg(sendMsgDto);

View File

@@ -1,103 +0,0 @@
//package kr.co.uplus.ez.common.security;
//
//import javax.crypto.Cipher;
//import javax.crypto.spec.IvParameterSpec;
//import javax.crypto.spec.SecretKeySpec;
//
//import org.apache.commons.codec.binary.Base64;
//
///**
// * key가 16byte(128bit)면 AES128로 동작한다.
// * key가 32byte(256bit)면 AES256으로 동작한다.
// */
//public class Aes256 {
//
// private static final String ALGORITHM = "AES";
// private static final String TRANSFORMATION = "AES/CBC/PKCS5Padding"; // algorithm/mode/padding
//// private static final String TRANSFORMATION = "AES/ECB/PKCS5Padding"; // "AES"와 같다. ECB mode cannot use IV
//
// public static byte[] encrypt(byte[] plainText, byte[] key) {
// byte[] iv = new byte[16];
// return encrypt(plainText, key, iv);
// }
//
// public static byte[] encrypt(byte[] plainText, byte[] key, byte[] iv) {
// try {
// Cipher c = Cipher.getInstance(TRANSFORMATION);
// SecretKeySpec k = new SecretKeySpec(key, ALGORITHM);
// IvParameterSpec ivSpec = new IvParameterSpec(iv);
// c.init(Cipher.ENCRYPT_MODE, k, ivSpec);
// return c.doFinal(plainText);
// }
// catch (Exception e) {
// throw new RuntimeException(e);
// }
// }
//
// public static String encryptBase64(String plainText, byte[] key) {
// byte[] iv = new byte[16];
// return encryptBase64(plainText, key, iv);
// }
//
// public static String encryptBase64(String plainText, byte[] key, byte[] iv) {
// byte[] enc = encrypt(plainText.getBytes(), key, iv);
// return new String(Base64.encodeBase64(enc));
// }
//
//
// public static byte[] decrypt(byte[] cipherText, byte[] key) {
// byte[] iv = new byte[16];
// return decrypt(cipherText, key, iv);
// }
//
// public static byte[] decrypt(byte[] cipherText, byte[] key, byte[] iv) {
// try {
// Cipher c = Cipher.getInstance(TRANSFORMATION);
// SecretKeySpec k = new SecretKeySpec(key, ALGORITHM);
// IvParameterSpec ivSpec = new IvParameterSpec(iv);
// c.init(Cipher.DECRYPT_MODE, k, ivSpec);
// return c.doFinal(cipherText);
// }
// catch (Exception e) {
// throw new RuntimeException(e);
// }
// }
//
// public static String decryptBase64(String b64CipherText, byte[] key) {
// byte[] iv = new byte[16];
// return decryptBase64(b64CipherText, key, iv);
// }
//
// public static String decryptBase64(String b64CipherText, byte[] key, byte[] iv) {
// byte[] enc = Base64.decodeBase64(b64CipherText.getBytes());
// return new String(decrypt(enc, key, iv));
// }
//
//
// public static String encryptNoIvBase64(String plainText, byte[] key) {
// try {
// Cipher c = Cipher.getInstance(ALGORITHM);
// SecretKeySpec k = new SecretKeySpec(key, ALGORITHM);
// c.init(Cipher.ENCRYPT_MODE, k); // ECB mode cannot use IV
// byte[] enc = c.doFinal(plainText.getBytes());
// return new String(Base64.encodeBase64(enc));
// }
// catch (Exception e) {
// throw new RuntimeException(e);
// }
// }
//
// public static String decryptNoIvBase64(String b64CipherText, byte[] key) {
// try {
// Cipher c = Cipher.getInstance(ALGORITHM);
// SecretKeySpec k = new SecretKeySpec(key, ALGORITHM);
// c.init(Cipher.DECRYPT_MODE, k); // ECB mode cannot use IV
// byte[] enc = Base64.decodeBase64(b64CipherText.getBytes());
// return new String(c.doFinal(enc));
// }
// catch (Exception e) {
// throw new RuntimeException(e);
// }
// }
//
//}

View File

@@ -214,118 +214,6 @@ public class EncryptionUtil {
return isHashCompare;
}
// public byte[] aesEncryptEcb(String sKey, String sText) {
// byte[] key = null;
// byte[] text = null;
// byte[] encrypted = null;
// final int AES_KEY_SIZE_128 = 128;
//
// try {
// // UTF-8
// key = sKey.getBytes("UTF-8");
//
// // Key size (128bit, 16byte)
// key = Arrays.copyOf(key, AES_KEY_SIZE_128 / 8);
//
// // UTF-8
// text = sText.getBytes("UTF-8");
//
// // AES/EBC/PKCS5Padding
// Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
// cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "AES"));
// encrypted = cipher.doFinal(text);
// } catch (Exception e) {
// encrypted = null;
// log.error("aesEncryptEcb exception. : {}", e.getMessage());
// }
// return encrypted;
// }
/*
* AES128 Decrypt
*/
// public byte[] aesDecryptEcb(String sKey, byte[] encrypted) throws UnsupportedEncodingException {
// byte[] key = null;
// byte[] decrypted = null;
// final int AES_KEY_SIZE_128 = 128;
//
// try {
// // UTF-8
// key = sKey.getBytes("UTF-8");
//
// // Key size 128 (128bit, 16byte)
// key = Arrays.copyOf(key, AES_KEY_SIZE_128 / 8);
//
// // AES/EBC/PKCS5Padding
// Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
// cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key, "AES"));
// decrypted = cipher.doFinal(encrypted);
// } catch (Exception e) {
// decrypted = null;
// log.error("aesDecryptEcb exception. : {}", e.getMessage());
// }
// return decrypted;
// }
/*
* AES256 Encrypt
*/
// public byte[] aes256EncryptEcb(String sKey, String sText) {
// byte[] key = null;
// byte[] text = null;
// byte[] encrypted = null;
// final int AES_KEY_SIZE_256 = 256;
//
// try {
// // UTF-8
// key = sKey.getBytes("UTF-8");
//
// // Key size (256bit, 16byte)
// key = Arrays.copyOf(key, AES_KEY_SIZE_256 / 8);
//
// // UTF-8
// text = sText.getBytes("UTF-8");
//
// // AES/EBC/PKCS5Padding
// Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
// cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "AES"));
// encrypted = cipher.doFinal(text);
// } catch (Exception e) {
// encrypted = null;
// log.error("aes256EncryptEcb exception. : {}", e.getMessage());
// }
//
// return encrypted;
// }
/*
* AES256 Decrypt
*/
// public byte[] aes256DecryptEcb(String sKey, byte[] encrypted) throws UnsupportedEncodingException {
// byte[] key = null;
// byte[] decrypted = null;
// final int AES_KEY_SIZE_256 = 256;
//
// try {
// // UTF-8
// key = sKey.getBytes("UTF-8");
//
// // Key size (256bit, 16byte)
// key = Arrays.copyOf(key, AES_KEY_SIZE_256 / 8);
//
// // AES/EBC/PKCS5Padding
// Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
// cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key, "AES"));
// decrypted = cipher.doFinal(encrypted);
// } catch (Exception e) {
// decrypted = null;
// log.error("aes256DecryptEcb exception. : {}", e.getMessage());
// }
//
// return decrypted;
// }
public String toHexString(byte[] b) {
StringBuffer sb = new StringBuffer();

View File

@@ -19,14 +19,14 @@ public class FileIoUtils {
public static String getName(String filePath) {
return FilenameUtils.getName(filePath);
}
/**
* @return d:/Downloads/aaa.txt --> txt
*/
public static String getExtension(String filePath) {
return FilenameUtils.getExtension(filePath);
}
/**
* @return d:/Downloads/aaa.txt --> d:/Downloads
*/
@@ -34,7 +34,7 @@ public class FileIoUtils {
int idx = filePath.indexOf(getName(filePath));
return filePath.substring(0, idx > 0 ? idx - 1 : 0);
}
/**
* @return d:/Downloads/aaa.txt --> aaa
*/
@@ -57,11 +57,11 @@ public class FileIoUtils {
public static String streamToString(InputStream input) {
return streamToString(input, null);
}
public static String fileToString(File file) {
return fileToString(file, null);
}
public static String fileToString(File file, String encoding) {
try {
return org.apache.commons.io.FileUtils.readFileToString(file, encoding);
@@ -70,11 +70,11 @@ public class FileIoUtils {
throw new RuntimeException(e);
}
}
public static void stringToFile(String text, File file) {
stringToFile(text, file, null);
}
public static void stringToFile(String text, File file, String encoding) {
try {
org.apache.commons.io.FileUtils.write(file, text, encoding);
@@ -83,7 +83,7 @@ public class FileIoUtils {
throw new RuntimeException(e);
}
}
/**
* stream을 복사하고 두 스트림 모두 닫는다.
*/
@@ -99,7 +99,7 @@ public class FileIoUtils {
IOUtils.closeQuietly(dst);
}
}
public static void copy(String src, String dst) {
try {
org.apache.commons.io.FileUtils.copyFile(new File(src), new File(dst));
@@ -108,14 +108,14 @@ public class FileIoUtils {
throw new RuntimeException(e);
}
}
public static File mkDirIfNotExist(String dir) {
File file = new File(dir);
if (!file.isDirectory())
file.mkdirs();
return file;
}
public static void fileDownload(Resource res
, HttpServletRequest request, HttpServletResponse response) throws IOException {
fileDownload(res.getFile(), request, response);
@@ -137,16 +137,16 @@ public class FileIoUtils {
fname = new String(fileName.getBytes("EUC-KR"), "8859_1");
dispos = String.format("attachment; filename=\"%s\"", fname);
}
response.setHeader("Content-Disposition", dispos);
response.setHeader("Content-Transfer-Encoding", "binary;");
}
public static void fileDownload(File file, HttpServletRequest request, HttpServletResponse response) throws IOException {
String fileName = file.getName();
long fileSize = file.length();
InputStream in = new FileInputStream(file);
// response header
setDownloadHeader(fileName, request, response);
response.setHeader("Content-Length", String.valueOf(fileSize));
@@ -161,15 +161,15 @@ public class FileIoUtils {
IOUtils.closeQuietly(out);
}
}
public static boolean fileUpload(MultipartFile upfile, File savefile) throws IOException {
return fileUpload(upfile, savefile, false);
}
public static boolean fileUpload(MultipartFile upfile, File savefile, boolean append) throws IOException {
if (upfile == null || upfile.isEmpty())
return false;
String saveDir = getDirName(savefile.getAbsolutePath());
mkDirIfNotExist(saveDir);
if (!append) {
@@ -190,8 +190,8 @@ public class FileIoUtils {
}
return true;
}
/**
* @param crext "."를 포함해야 정확한 결과를 얻는다.
*/
@@ -209,59 +209,20 @@ public class FileIoUtils {
*/
public static void writeLine(File file, String line) {
try {
org.apache.commons.io.FileUtils.writeLines(file, Arrays.asList(line), true);
org.apache.commons.io.FileUtils.writeLines(file, Arrays.asList(line), true);
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
public static void writeLines(File file, List<String> lines) {
try {
org.apache.commons.io.FileUtils.writeLines(file, lines, true);
org.apache.commons.io.FileUtils.writeLines(file, lines, true);
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
// public static List<File> unzip(File zip, String saveDir) throws Exception {
// int bufSize = 1024 * 64;
// List<File> files = new ArrayList<File>();
//
// ZipInputStream in = new ZipInputStream(new BufferedInputStream(new FileInputStream(zip), bufSize));
// ZipEntry entry = null;
//
// while ((entry = in.getNextEntry()) != null) {
// byte[] buffer = new byte[bufSize];
//
// File outfile = new File(saveDir, entry.getName());
// OutputStream out = new BufferedOutputStream(new FileOutputStream(outfile), bufSize);
//
// int size = 0;
// while ((size = in.read(buffer, 0, bufSize)) != -1) {
// out.write(buffer, 0, size);
// }
// out.flush();
// IOUtils.closeQuietly(out);
// files.add(outfile);
// }
//
// IOUtils.closeQuietly(in);
// return files;
// }
// public static File ungzip(File gzip, String saveDir) throws Exception {
// String outName = getBaseName(gzip.getName());
// File outfile = new File(saveDir, outName);
//
// InputStream in = new GZIPInputStream(new FileInputStream(gzip));
// OutputStream out = new FileOutputStream(outfile);
// IOUtils.copy(in, out);
//
// IOUtils.closeQuietly(in);
// IOUtils.closeQuietly(out);
// return outfile;
// }
}
}