|
@@ -1,5 +1,6 @@
|
|
|
package com.style24.core.biz.service;
|
|
package com.style24.core.biz.service;
|
|
|
|
|
|
|
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.text.NumberFormat;
|
|
import java.text.NumberFormat;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collection;
|
|
import java.util.Collection;
|
|
@@ -29,6 +30,11 @@ import com.usafe.guarantee.InsuranceInfo;
|
|
|
import com.usafe.guarantee.InsuranceManager;
|
|
import com.usafe.guarantee.InsuranceManager;
|
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import sun.misc.BASE64Decoder;
|
|
|
|
|
+import sun.misc.BASE64Encoder;
|
|
|
|
|
+
|
|
|
|
|
+import javax.crypto.Cipher;
|
|
|
|
|
+import javax.crypto.spec.SecretKeySpec;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 주문관리 Service
|
|
* 주문관리 Service
|
|
@@ -2312,6 +2318,51 @@ public class TscOrderService {
|
|
|
|
|
|
|
|
return "SUCCESS";
|
|
return "SUCCESS";
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public String encodeStr(String str) throws Exception {
|
|
|
|
|
+ byte[] SECRET_KEY = { 115, 51, 117, 70, 49, 65, 107, 125, 43, 118, 48, 65, 38, 57, 77, 67, 74, 120, 90, 87, 78, 80, 101, 102 };
|
|
|
|
|
+ SecretKeySpec KEYSPEC = new SecretKeySpec(SECRET_KEY, "DESede");
|
|
|
|
|
+
|
|
|
|
|
+ String result = null;
|
|
|
|
|
+ Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding");
|
|
|
|
|
+ cipher.init(1, KEYSPEC);
|
|
|
|
|
+ byte[] plainText = str.getBytes(StandardCharsets.UTF_8);
|
|
|
|
|
+ byte[] cipherText = cipher.doFinal(plainText);
|
|
|
|
|
+ result = (new BASE64Encoder()).encode(cipherText);
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String decodeStr(String str) throws Exception {
|
|
|
|
|
+ byte[] SECRET_KEY = { 115, 51, 117, 70, 49, 65, 107, 125, 43, 118, 48, 65, 38, 57, 77, 67, 74, 120, 90, 87, 78, 80, 101, 102 };
|
|
|
|
|
+ SecretKeySpec KEYSPEC = new SecretKeySpec(SECRET_KEY, "DESede");
|
|
|
|
|
+
|
|
|
|
|
+ String result = null;
|
|
|
|
|
+ Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding");
|
|
|
|
|
+ cipher.init(2, KEYSPEC);
|
|
|
|
|
+ byte[] base64bytes = (new BASE64Decoder()).decodeBuffer(str);
|
|
|
|
|
+ byte[] decryptedText = cipher.doFinal(base64bytes);
|
|
|
|
|
+ result = new String(decryptedText, StandardCharsets.UTF_8);
|
|
|
|
|
+ result = result.trim();
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String simpleEncode(String strVal) {
|
|
|
|
|
+ String result = strVal;
|
|
|
|
|
+ result = result.replaceAll("=", "%3D");
|
|
|
|
|
+ result = result.replaceAll("&", "%26");
|
|
|
|
|
+ result = result.replaceAll("%", "%25");
|
|
|
|
|
+ result = result.replaceAll(" ", "%20");
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String simpleDecode(String strVal) {
|
|
|
|
|
+ String result = strVal;
|
|
|
|
|
+ result = result.replaceAll("%3D", "=");
|
|
|
|
|
+ result = result.replaceAll("%26", "&");
|
|
|
|
|
+ result = result.replaceAll("%25", "%");
|
|
|
|
|
+ result = result.replaceAll("%20", " ");
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|