更改文字,更改AppGuide字段,实名逻辑更改,收银点判断逻辑更改,RSA相关
This commit is contained in:
@@ -11,6 +11,8 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author djh
|
||||
* 简介富文本内容
|
||||
@@ -30,6 +32,13 @@ public class IntroduceController {
|
||||
}
|
||||
|
||||
AppGuide entity = appGuideService.getByCode(code);
|
||||
return ResultGenerator.genSuccessResult(entity == null? "": entity.getContent());
|
||||
if (!"SHTGKT".equals(code)){
|
||||
return ResultGenerator.genSuccessResult(entity == null ? "" : entity.getContent());
|
||||
}
|
||||
if (Objects.equals(entity.getType(), "1")) {
|
||||
return ResultGenerator.genSuccessResult(entity == null ? "" : entity.getContent());
|
||||
}else {
|
||||
return ResultGenerator.genFailResult("");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,6 +106,9 @@ public class MerchantCashPlaceController {
|
||||
return ResultGenerator.genSuccessResult(pageData);
|
||||
}
|
||||
private void size(String character){
|
||||
if (character.isEmpty()){
|
||||
throw new MsgException("地址或收银点名称不能为空");
|
||||
}
|
||||
if (character.length() >= 50){
|
||||
throw new MsgException("输入内容过长");
|
||||
}
|
||||
|
||||
@@ -22,6 +22,6 @@ spring:
|
||||
max-size: 20
|
||||
|
||||
server:
|
||||
# servlet:
|
||||
# context-path: /api
|
||||
servlet:
|
||||
context-path: /api
|
||||
port: 7004
|
||||
|
||||
@@ -0,0 +1,396 @@
|
||||
package cn.pluss.platform.util;
|
||||
|
||||
import org.apache.tomcat.util.codec.binary.Base64;
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
public class BASE64 {
|
||||
|
||||
static private final int BASELENGTH = 128;
|
||||
static private final int LOOKUPLENGTH = 64;
|
||||
static private final int TWENTYFOURBITGROUP = 24;
|
||||
static private final int EIGHTBIT = 8;
|
||||
static private final int SIXTEENBIT = 16;
|
||||
static private final int FOURBYTE = 4;
|
||||
static private final int SIGN = -128;
|
||||
static private final char PAD = '=';
|
||||
static private final boolean fDebug = false;
|
||||
static final private byte[] base64Alphabet = new byte[BASELENGTH];
|
||||
static final private char[] lookUpBase64Alphabet = new char[LOOKUPLENGTH];
|
||||
|
||||
static {
|
||||
for (int i = 0; i < BASELENGTH; ++i) {
|
||||
base64Alphabet[i] = -1;
|
||||
}
|
||||
for (int i = 'Z'; i >= 'A'; i--) {
|
||||
base64Alphabet[i] = (byte) (i - 'A');
|
||||
}
|
||||
for (int i = 'z'; i >= 'a'; i--) {
|
||||
base64Alphabet[i] = (byte) (i - 'a' + 26);
|
||||
}
|
||||
|
||||
for (int i = '9'; i >= '0'; i--) {
|
||||
base64Alphabet[i] = (byte) (i - '0' + 52);
|
||||
}
|
||||
|
||||
base64Alphabet['+'] = 62;
|
||||
base64Alphabet['/'] = 63;
|
||||
|
||||
for (int i = 0; i <= 25; i++) {
|
||||
lookUpBase64Alphabet[i] = (char) ('A' + i);
|
||||
}
|
||||
|
||||
for (int i = 26, j = 0; i <= 51; i++, j++) {
|
||||
lookUpBase64Alphabet[i] = (char) ('a' + j);
|
||||
}
|
||||
|
||||
for (int i = 52, j = 0; i <= 61; i++, j++) {
|
||||
lookUpBase64Alphabet[i] = (char) ('0' + j);
|
||||
}
|
||||
lookUpBase64Alphabet[62] = (char) '+';
|
||||
lookUpBase64Alphabet[63] = (char) '/';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 将本地图片进行Base64位编码
|
||||
*
|
||||
* @param imgUrl 图片的url路径,如D:\\photo\\1.png
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String encodeImgageToBase64(File imageFile) {
|
||||
// 将图片文件转化为字节数组字符串,并对其进行Base64编码处理
|
||||
// 其进行Base64编码处理
|
||||
byte[] data = null;
|
||||
// 读取图片字节数组
|
||||
try {
|
||||
InputStream in = new FileInputStream(imageFile);
|
||||
data = new byte[in.available()];
|
||||
in.read(data);
|
||||
in.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 对字节数组Base64编码
|
||||
BASE64Encoder encoder = new BASE64Encoder();
|
||||
// 返回Base64编码过的字节数组字符串
|
||||
return encoder.encode(data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static boolean isWhiteSpace(char octect) {
|
||||
return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9);
|
||||
}
|
||||
|
||||
private static boolean isPad(char octect) {
|
||||
return (octect == PAD);
|
||||
}
|
||||
|
||||
private static boolean isData(char octect) {
|
||||
return (octect < BASELENGTH && base64Alphabet[octect] != -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes hex octects into Base64
|
||||
*
|
||||
* @param binaryData Array containing binaryData
|
||||
* @return Encoded Base64 array
|
||||
*/
|
||||
public static String encode(byte[] binaryData) {
|
||||
|
||||
if (binaryData == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int lengthDataBits = binaryData.length * EIGHTBIT;
|
||||
if (lengthDataBits == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
|
||||
int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP;
|
||||
int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets;
|
||||
char encodedData[] = null;
|
||||
|
||||
encodedData = new char[numberQuartet * 4];
|
||||
|
||||
byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0;
|
||||
|
||||
int encodedIndex = 0;
|
||||
int dataIndex = 0;
|
||||
if (fDebug) {
|
||||
System.out.println("number of triplets = " + numberTriplets);
|
||||
}
|
||||
|
||||
for (int i = 0; i < numberTriplets; i++) {
|
||||
b1 = binaryData[dataIndex++];
|
||||
b2 = binaryData[dataIndex++];
|
||||
b3 = binaryData[dataIndex++];
|
||||
|
||||
if (fDebug) {
|
||||
System.out.println("b1= " + b1 + ", b2= " + b2 + ", b3= " + b3);
|
||||
}
|
||||
|
||||
l = (byte) (b2 & 0x0f);
|
||||
k = (byte) (b1 & 0x03);
|
||||
|
||||
byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
|
||||
byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0);
|
||||
byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6) : (byte) ((b3) >> 6 ^ 0xfc);
|
||||
|
||||
if (fDebug) {
|
||||
System.out.println("val2 = " + val2);
|
||||
System.out.println("k4 = " + (k << 4));
|
||||
System.out.println("vak = " + (val2 | (k << 4)));
|
||||
}
|
||||
|
||||
encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
|
||||
encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)];
|
||||
encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3];
|
||||
encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f];
|
||||
}
|
||||
|
||||
// form integral number of 6-bit groups
|
||||
if (fewerThan24bits == EIGHTBIT) {
|
||||
b1 = binaryData[dataIndex];
|
||||
k = (byte) (b1 & 0x03);
|
||||
if (fDebug) {
|
||||
System.out.println("b1=" + b1);
|
||||
System.out.println("b1<<2 = " + (b1 >> 2));
|
||||
}
|
||||
byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
|
||||
encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
|
||||
encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4];
|
||||
encodedData[encodedIndex++] = PAD;
|
||||
encodedData[encodedIndex++] = PAD;
|
||||
} else if (fewerThan24bits == SIXTEENBIT) {
|
||||
b1 = binaryData[dataIndex];
|
||||
b2 = binaryData[dataIndex + 1];
|
||||
l = (byte) (b2 & 0x0f);
|
||||
k = (byte) (b1 & 0x03);
|
||||
|
||||
byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
|
||||
byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0);
|
||||
|
||||
encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
|
||||
encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)];
|
||||
encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2];
|
||||
encodedData[encodedIndex++] = PAD;
|
||||
}
|
||||
|
||||
return new String(encodedData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes Base64 data into octects
|
||||
*
|
||||
* @param encoded string containing Base64 data
|
||||
* @return Array containind decoded data.
|
||||
*/
|
||||
public static byte[] decode(String encoded) {
|
||||
|
||||
if (encoded == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
char[] base64Data = encoded.toCharArray();
|
||||
// remove white spaces
|
||||
int len = removeWhiteSpace(base64Data);
|
||||
|
||||
if (len % FOURBYTE != 0) {
|
||||
return null;//should be divisible by four
|
||||
}
|
||||
|
||||
int numberQuadruple = (len / FOURBYTE);
|
||||
|
||||
if (numberQuadruple == 0) {
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
byte decodedData[] = null;
|
||||
byte b1 = 0, b2 = 0, b3 = 0, b4 = 0;
|
||||
char d1 = 0, d2 = 0, d3 = 0, d4 = 0;
|
||||
|
||||
int i = 0;
|
||||
int encodedIndex = 0;
|
||||
int dataIndex = 0;
|
||||
decodedData = new byte[(numberQuadruple) * 3];
|
||||
|
||||
for (; i < numberQuadruple - 1; i++) {
|
||||
|
||||
if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))
|
||||
|| !isData((d3 = base64Data[dataIndex++]))
|
||||
|| !isData((d4 = base64Data[dataIndex++]))) {
|
||||
return null;
|
||||
}//if found "no data" just return null
|
||||
|
||||
b1 = base64Alphabet[d1];
|
||||
b2 = base64Alphabet[d2];
|
||||
b3 = base64Alphabet[d3];
|
||||
b4 = base64Alphabet[d4];
|
||||
|
||||
decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
|
||||
decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
|
||||
decodedData[encodedIndex++] = (byte) (b3 << 6 | b4);
|
||||
}
|
||||
|
||||
if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) {
|
||||
return null;//if found "no data" just return null
|
||||
}
|
||||
|
||||
b1 = base64Alphabet[d1];
|
||||
b2 = base64Alphabet[d2];
|
||||
|
||||
d3 = base64Data[dataIndex++];
|
||||
d4 = base64Data[dataIndex++];
|
||||
if (!isData((d3)) || !isData((d4))) {//Check if they are PAD characters
|
||||
if (isPad(d3) && isPad(d4)) {
|
||||
if ((b2 & 0xf) != 0)//last 4 bits should be zero
|
||||
{
|
||||
return null;
|
||||
}
|
||||
byte[] tmp = new byte[i * 3 + 1];
|
||||
System.arraycopy(decodedData, 0, tmp, 0, i * 3);
|
||||
tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
|
||||
return tmp;
|
||||
} else if (!isPad(d3) && isPad(d4)) {
|
||||
b3 = base64Alphabet[d3];
|
||||
if ((b3 & 0x3) != 0)//last 2 bits should be zero
|
||||
{
|
||||
return null;
|
||||
}
|
||||
byte[] tmp = new byte[i * 3 + 2];
|
||||
System.arraycopy(decodedData, 0, tmp, 0, i * 3);
|
||||
tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
|
||||
tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
|
||||
return tmp;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else { //No PAD e.g 3cQl
|
||||
b3 = base64Alphabet[d3];
|
||||
b4 = base64Alphabet[d4];
|
||||
decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
|
||||
decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
|
||||
decodedData[encodedIndex++] = (byte) (b3 << 6 | b4);
|
||||
|
||||
}
|
||||
|
||||
return decodedData;
|
||||
}
|
||||
|
||||
/**
|
||||
* remove WhiteSpace from MIME containing encoded Base64 data.
|
||||
*
|
||||
* @param data the byte array of base64 data (with WS)
|
||||
* @return the new length
|
||||
*/
|
||||
private static int removeWhiteSpace(char[] data) {
|
||||
if (data == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// count characters that's not whitespace
|
||||
int newSize = 0;
|
||||
int len = data.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (!isWhiteSpace(data[i])) {
|
||||
data[newSize++] = data[i];
|
||||
}
|
||||
}
|
||||
return newSize;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 功能描述:Base64加密(将byte[]转换成字符串) 方法。
|
||||
* <P/>
|
||||
* 创建时间:2017-02-14
|
||||
* <P/>
|
||||
* 创建人: 董耀明
|
||||
*
|
||||
* @param data byte[]类型 要加密的数据
|
||||
*
|
||||
* @return String类型 加密后结果
|
||||
*
|
||||
*/
|
||||
public static String encryptBASE64(byte[] data)
|
||||
{
|
||||
return Base64.encodeBase64String(data);
|
||||
//return (new BASE64Encoder()).encodeBuffer(data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 功能描述:Base64加密(将byte[]转换成字符串) 方法。
|
||||
* <P/>
|
||||
* 创建时间:2017-02-14
|
||||
* <P/>
|
||||
* 创建人: 董耀明
|
||||
*
|
||||
* @param data String类型 要加密的数据
|
||||
*
|
||||
* @return String类型 加密后结果
|
||||
*
|
||||
*/
|
||||
public static String encryptBASE64(String data)
|
||||
{
|
||||
try {
|
||||
//return (new BASE64Encoder()).encodeBuffer(data.getBytes("UTF-8"));
|
||||
return Base64.encodeBase64String(data.getBytes("UTF-8"));
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 功能描述:Base64加密(将byte[]转换成字符串) 方法。
|
||||
* <P/>
|
||||
* 创建时间:2017-02-14
|
||||
* <P/>
|
||||
* 创建人: 董耀明
|
||||
*
|
||||
* @param data String类型 要加密的数据
|
||||
*
|
||||
* @param encode String类型 编码类型
|
||||
*
|
||||
* @return String类型 加密后结果
|
||||
*
|
||||
*/
|
||||
public static String encryptBASE64(String data,String encode)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
if (encode == null || "".equals(encode))
|
||||
{
|
||||
|
||||
return Base64.encodeBase64String(data.getBytes());
|
||||
|
||||
} else
|
||||
{
|
||||
return Base64.encodeBase64String(data.getBytes(encode));
|
||||
}
|
||||
|
||||
} catch (UnsupportedEncodingException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class MobV2PushUtilAndroid {
|
||||
PushMessage pushMessage = new PushMessage();
|
||||
pushDTO.setPushMessage(pushMessage);
|
||||
//此格式的透传消息由 unipush 做了特殊处理,会自动展示通知栏。开发者也可自定义其它格式,在客户端自己处理。
|
||||
//pushMessage.setTransmission(" {title:\"标题\",content:\"内容\",payload:\"快银到账1万元\"}");
|
||||
//pushMessage.setTransmission(" {title:\"标题\",content:\"内容\",payload:\"银收客到账1万元\"}");
|
||||
|
||||
//pushMessage.setTransmission("{title:" + title + ", content:" + content + ext);
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ public class MobV2PushUtilIOS {
|
||||
PushMessage pushMessage = new PushMessage();
|
||||
pushDTO.setPushMessage(pushMessage);
|
||||
//此格式的透传消息由 unipush 做了特殊处理,会自动展示通知栏。开发者也可自定义其它格式,在客户端自己处理。
|
||||
//pushMessage.setTransmission(" {title:\"标题\",content:\"内容\",payload:\"快银到账1万元\"}");
|
||||
//pushMessage.setTransmission(" {title:\"标题\",content:\"内容\",payload:\"银收客到账1万元\"}");
|
||||
|
||||
//pushMessage.setTransmission("{title:" + title + ", content:" + content + ext);
|
||||
|
||||
|
||||
@@ -0,0 +1,402 @@
|
||||
package cn.pluss.platform.util;
|
||||
|
||||
import com.alipay.api.internal.util.codec.Base64;
|
||||
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.KeyPair;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.interfaces.RSAPrivateKey;
|
||||
import java.security.interfaces.RSAPublicKey;
|
||||
|
||||
import static cn.hutool.crypto.KeyUtil.getKeyPair;
|
||||
import static cn.pluss.platform.util.RSASignature.signVerify;
|
||||
import static cn.pluss.platform.util.RSAUtil.*;
|
||||
|
||||
/**
|
||||
* @author: zph
|
||||
* @Date: 2020/7/10 15:28
|
||||
* @Description: RSA加密解密工具类
|
||||
*/
|
||||
public class RSAEncrypt {
|
||||
/**
|
||||
* 字节数据转字符串专用集合
|
||||
*/
|
||||
private static final char[] HEX_CHAR = { '0', '1', '2', '3', '4', '5', '6',
|
||||
'7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
|
||||
|
||||
|
||||
// FTP服务器hostname
|
||||
public static String HOST = "";
|
||||
|
||||
// FTP服务器端口
|
||||
// public static Integer PORT = ;
|
||||
|
||||
// FTP登录账号
|
||||
public static String USERNAME = "";
|
||||
|
||||
// FTP登录密码
|
||||
public static String PASSWORD = "";
|
||||
|
||||
// FTP上传路径
|
||||
public static String INVOICE_BASE_PATH = "";
|
||||
/**
|
||||
* 随机生成密钥对
|
||||
*/
|
||||
// public static void genKeyPair() {
|
||||
// // KeyPairGenerator类用于生成公钥和私钥对,基于RSA算法生成对象
|
||||
// KeyPairGenerator keyPairGen = null;
|
||||
// try {
|
||||
// keyPairGen = KeyPairGenerator.getInstance("RSA");
|
||||
// } catch (NoSuchAlgorithmException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// // 初始化密钥对生成器,密钥大小为96-1024位
|
||||
// keyPairGen.initialize(1024,new SecureRandom());
|
||||
// // 生成一个密钥对,保存在keyPair中
|
||||
// KeyPair keyPair = keyPairGen.generateKeyPair();
|
||||
// // 得到私钥
|
||||
// RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
|
||||
// // 得到公钥
|
||||
// RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
|
||||
// try {
|
||||
// // 得到公钥字符串
|
||||
// String publicKeyString = BASE64.encode(publicKey.getEncoded());
|
||||
// // 得到私钥字符串
|
||||
// String privateKeyString = BASE64.encode(privateKey.getEncoded());
|
||||
// System.err.println(publicKeyString);
|
||||
// System.err.println(privateKeyString);
|
||||
// // 将公密钥对写入到文件
|
||||
// /*InputStream is = null;
|
||||
// InputStream is1 = null;
|
||||
// is = new ByteArrayInputStream(publicKeyString.getBytes());
|
||||
// is1 = new ByteArrayInputStream(privateKeyString.getBytes());
|
||||
// FTPClient ftpClient = new FTPClient();
|
||||
// ftpClient.connect(HOST);
|
||||
// ftpClient.login(USERNAME,PASSWORD);
|
||||
// ftpClient.changeWorkingDirectory(INVOICE_BASE_PATH);
|
||||
// ftpClient.setFileType(FTPClient.LOCAL_FILE_TYPE);
|
||||
// ftpClient.storeFile(new String("publicKey.keystore".getBytes(),"iso-8859-1"),is);
|
||||
// ftpClient.storeFile(new String("privateKey.keystore".getBytes(),"iso-8859-1"),is1);
|
||||
// is.close();
|
||||
// is1.close();*/
|
||||
// //FileWriter pubfw = new FileWriter(filePath + "/publicKey.keystore");
|
||||
// //FileWriter prifw = new FileWriter(filePath + "/privateKey.keystore");
|
||||
// /*BufferedWriter pubbw = new BufferedWriter(pubfw);
|
||||
// BufferedWriter pribw = new BufferedWriter(prifw);
|
||||
// pubbw.write(publicKeyString);
|
||||
// pribw.write(privateKeyString);
|
||||
// pubbw.flush();
|
||||
// pubbw.close();
|
||||
// pubfw.close();
|
||||
// pribw.flush();
|
||||
// pribw.close();
|
||||
// prifw.close();*/
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 从文件中输入流中加载公钥
|
||||
// *
|
||||
// * @param
|
||||
// *
|
||||
// * @throws Exception
|
||||
// * 加载公钥时产生的异常
|
||||
// */
|
||||
// public static String loadPublicKeyByFile() throws Exception {
|
||||
// try {
|
||||
// FTPClient ftpClient = new FTPClient();
|
||||
// ftpClient.connect(HOST);
|
||||
// ftpClient.login(USERNAME,PASSWORD);
|
||||
// ftpClient.changeWorkingDirectory(INVOICE_BASE_PATH);
|
||||
// InputStream is = ftpClient.retrieveFileStream("publicKey.keystore");
|
||||
// BufferedReader br = new BufferedReader(new InputStreamReader(is,"UTF-8"));
|
||||
// String readLine = null;
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// while ((readLine = br.readLine()) != null) {
|
||||
// sb.append(readLine);
|
||||
// }
|
||||
// br.close();
|
||||
// return sb.toString();
|
||||
// } catch (IOException e) {
|
||||
// throw new Exception("公钥数据流读取错误");
|
||||
// } catch (NullPointerException e) {
|
||||
// throw new Exception("公钥输入流为空");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 从字符串中加载公钥
|
||||
// *
|
||||
// * @param publicKeyStr
|
||||
// * 公钥数据字符串
|
||||
// * @throws Exception
|
||||
// * 加载公钥时产生的异常
|
||||
// */
|
||||
// public static RSAPublicKey loadPublicKeyByStr(String publicKeyStr)
|
||||
// throws Exception {
|
||||
// try {
|
||||
// byte[] buffer = BASE64.decode(publicKeyStr);
|
||||
// KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
// X509EncodedKeySpec keySpec = new X509EncodedKeySpec(buffer);
|
||||
// return (RSAPublicKey) keyFactory.generatePublic(keySpec);
|
||||
// } catch (NoSuchAlgorithmException e) {
|
||||
// throw new Exception("无此算法");
|
||||
// } catch (InvalidKeySpecException e) {
|
||||
// throw new Exception("公钥非法");
|
||||
// } catch (NullPointerException e) {
|
||||
// throw new Exception("公钥数据为空");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 从文件中加载私钥
|
||||
// *
|
||||
// * @param
|
||||
// *
|
||||
// * @return 是否成功
|
||||
// * @throws Exception
|
||||
// */
|
||||
// public static String loadPrivateKeyByFile() throws Exception {
|
||||
// try {
|
||||
// FTPClient ftpClient = new FTPClient();
|
||||
// ftpClient.connect(HOST);
|
||||
// ftpClient.login(USERNAME,PASSWORD);
|
||||
// ftpClient.changeWorkingDirectory(INVOICE_BASE_PATH);
|
||||
// InputStream is = ftpClient.retrieveFileStream("privateKey.keystore");
|
||||
// BufferedReader br = new BufferedReader(new InputStreamReader(is,"UTF-8"));
|
||||
// String readLine = null;
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// while ((readLine = br.readLine()) != null) {
|
||||
// sb.append(readLine);
|
||||
// }
|
||||
// br.close();
|
||||
// return sb.toString();
|
||||
// } catch (IOException e) {
|
||||
// throw new Exception("私钥数据读取错误");
|
||||
// } catch (NullPointerException e) {
|
||||
// throw new Exception("私钥输入流为空");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static RSAPrivateKey loadPrivateKeyByStr(String privateKeyStr)
|
||||
// throws Exception {
|
||||
// try {
|
||||
// byte[] buffer = BASE64.decode(privateKeyStr);
|
||||
// PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(buffer);
|
||||
// KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
// return (RSAPrivateKey) keyFactory.generatePrivate(keySpec);
|
||||
// } catch (NoSuchAlgorithmException e) {
|
||||
// throw new Exception("无此算法");
|
||||
// } catch (InvalidKeySpecException e) {
|
||||
// throw new Exception("私钥非法");
|
||||
// } catch (NullPointerException e) {
|
||||
// throw new Exception("私钥数据为空");
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 公钥加密过程
|
||||
*
|
||||
* @param publicKey
|
||||
* 公钥
|
||||
* @param plainTextData
|
||||
* 明文数据
|
||||
* @return
|
||||
* @throws Exception
|
||||
* 加密过程中的异常信息
|
||||
*/
|
||||
public static byte[] encrypt(RSAPublicKey publicKey, byte[] plainTextData)
|
||||
throws Exception {
|
||||
if (publicKey == null) {
|
||||
throw new Exception("加密公钥为空, 请设置");
|
||||
}
|
||||
Cipher cipher = null;
|
||||
try {
|
||||
// 使用默认RSA
|
||||
cipher = Cipher.getInstance("RSA");
|
||||
// cipher= Cipher.getInstance("RSA", new BouncyCastleProvider());
|
||||
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||
byte[] output = cipher.doFinal(plainTextData);
|
||||
return output;
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new Exception("无此加密算法");
|
||||
} catch (NoSuchPaddingException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} catch (InvalidKeyException e) {
|
||||
throw new Exception("加密公钥非法,请检查");
|
||||
} catch (IllegalBlockSizeException e) {
|
||||
throw new Exception("明文长度非法");
|
||||
} catch (BadPaddingException e) {
|
||||
throw new Exception("明文数据已损坏");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 私钥加密过程
|
||||
*
|
||||
* @param privateKey
|
||||
* 私钥
|
||||
* @param plainTextData
|
||||
* 明文数据
|
||||
* @return
|
||||
* @throws Exception
|
||||
* 加密过程中的异常信息
|
||||
*/
|
||||
public static byte[] encrypt(RSAPrivateKey privateKey, byte[] plainTextData)
|
||||
throws Exception {
|
||||
if (privateKey == null) {
|
||||
throw new Exception("加密私钥为空, 请设置");
|
||||
}
|
||||
Cipher cipher = null;
|
||||
try {
|
||||
// 使用默认RSA
|
||||
cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
|
||||
byte[] output = cipher.doFinal(plainTextData);
|
||||
return output;
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new Exception("无此加密算法");
|
||||
} catch (NoSuchPaddingException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} catch (InvalidKeyException e) {
|
||||
throw new Exception("加密私钥非法,请检查");
|
||||
} catch (IllegalBlockSizeException e) {
|
||||
throw new Exception("明文长度非法");
|
||||
} catch (BadPaddingException e) {
|
||||
throw new Exception("明文数据已损坏");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 私钥解密过程
|
||||
*
|
||||
* @param privateKey
|
||||
* 私钥
|
||||
* @param cipherData
|
||||
* 密文数据
|
||||
* @return 明文
|
||||
* @throws Exception
|
||||
* 解密过程中的异常信息
|
||||
*/
|
||||
public static byte[] decrypt(RSAPrivateKey privateKey, byte[] cipherData)
|
||||
throws Exception {
|
||||
if (privateKey == null) {
|
||||
throw new Exception("解密私钥为空, 请设置");
|
||||
}
|
||||
Cipher cipher = null;
|
||||
try {
|
||||
// 使用默认RSA
|
||||
cipher = Cipher.getInstance("RSA");
|
||||
// cipher= Cipher.getInstance("RSA", new BouncyCastleProvider());
|
||||
cipher.init(Cipher.DECRYPT_MODE, privateKey);
|
||||
byte[] output = cipher.doFinal(cipherData);
|
||||
return output;
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new Exception("无此解密算法");
|
||||
} catch (NoSuchPaddingException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} catch (InvalidKeyException e) {
|
||||
throw new Exception("解密私钥非法,请检查");
|
||||
} catch (IllegalBlockSizeException e) {
|
||||
throw new Exception("密文长度非法");
|
||||
} catch (BadPaddingException e) {
|
||||
throw new Exception("密文数据已损坏");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 公钥解密过程
|
||||
*
|
||||
* @param publicKey
|
||||
* 公钥
|
||||
* @param cipherData
|
||||
* 密文数据
|
||||
* @return 明文
|
||||
* @throws Exception
|
||||
* 解密过程中的异常信息
|
||||
*/
|
||||
public static byte[] decrypt(RSAPublicKey publicKey, byte[] cipherData)
|
||||
throws Exception {
|
||||
if (publicKey == null) {
|
||||
throw new Exception("解密公钥为空, 请设置");
|
||||
}
|
||||
Cipher cipher = null;
|
||||
try {
|
||||
// 使用默认RSA
|
||||
cipher = Cipher.getInstance("RSA");
|
||||
// cipher= Cipher.getInstance("RSA", new BouncyCastleProvider());
|
||||
cipher.init(Cipher.DECRYPT_MODE, publicKey);
|
||||
byte[] output = cipher.doFinal(cipherData);
|
||||
return output;
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new Exception("无此解密算法");
|
||||
} catch (NoSuchPaddingException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} catch (InvalidKeyException e) {
|
||||
throw new Exception("解密公钥非法,请检查");
|
||||
} catch (IllegalBlockSizeException e) {
|
||||
throw new Exception("密文长度非法");
|
||||
} catch (BadPaddingException e) {
|
||||
throw new Exception("密文数据已损坏");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 字节数据转十六进制字符串
|
||||
*
|
||||
* @param data
|
||||
* 输入数据
|
||||
* @return 十六进制内容
|
||||
*/
|
||||
public static String byteArrayToString(byte[] data) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
// 取出字节的高四位 作为索引得到相应的十六进制标识符 注意无符号右移
|
||||
stringBuilder.append(HEX_CHAR[(data[i] & 0xf0) >>> 4]);
|
||||
// 取出字节的低四位 作为索引得到相应的十六进制标识符
|
||||
stringBuilder.append(HEX_CHAR[(data[i] & 0x0f)]);
|
||||
if (i < data.length - 1) {
|
||||
stringBuilder.append(' ');
|
||||
}
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
// 生成密钥对
|
||||
|
||||
// String privateKey = new String(Base64.encodeBase64(keyPair.getPrivate().getEncoded()));
|
||||
// String publicKey = new String(Base64.encodeBase64(keyPair.getPublic().getEncoded()));
|
||||
|
||||
// RSA加密
|
||||
String data = "{\"ordNo\":\"2017031601582703488262843972\",\"mno\":\"399190513665034\"}";
|
||||
System.out.println(data);
|
||||
// String encryptData = encrypt(data, getPublicKey(publicKey));
|
||||
// System.out.println("加密后内容:" + encryptData);
|
||||
// RSA解密
|
||||
// String decryptData = decrypt(encryptData, getPrivateKey(privateKey));
|
||||
// System.out.println("解密后内容:" + decryptData);
|
||||
|
||||
// RSA签名
|
||||
String sign = RSASignature.sign(data, CERT);
|
||||
System.out.println(sign);
|
||||
// RSA验签
|
||||
boolean result = signVerify(data, PUBLIC_KEY, sign);
|
||||
System.out.print("验签结果:" + result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.print("加解密异常");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,40 +15,73 @@ public class RSAEncryptUtil {
|
||||
private static final String CIPHER_PROVIDER = "SunJCE";
|
||||
private static final String TRANSFORMATION_PKCS1Paddiing = "RSA/ECB/PKCS1Padding";
|
||||
private static final String RSA_PKCS1_OAEP_PADDING = "RSA/ECB/OAEPWITHSHA-1ANDMGF1PADDING";
|
||||
|
||||
|
||||
private static final String CHAR_ENCODING = "UTF-8";// 固定值,无须修改
|
||||
private static final String CERT ="-----BEGIN CERTIFICATE-----\r\n" +
|
||||
"MIID3DCCAsSgAwIBAgIUTz/ylkJ1ui0tgyC8gYf7PhjSLf4wDQYJKoZIhvcNAQEL\r\n" +
|
||||
"BQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsT\r\n" +
|
||||
"FFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3Qg\r\n" +
|
||||
"Q0EwHhcNMTkwOTE5MDYzOTI4WhcNMjQwOTE3MDYzOTI4WjBuMRgwFgYDVQQDDA9U\r\n" +
|
||||
"ZW5wYXkuY29tIHNpZ24xEzARBgNVBAoMClRlbnBheS5jb20xHTAbBgNVBAsMFFRl\r\n" +
|
||||
"bnBheS5jb20gQ0EgQ2VudGVyMQswCQYDVQQGDAJDTjERMA8GA1UEBwwIU2hlblpo\r\n" +
|
||||
"ZW4wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCgVuNIZDy2F7UYQw7+\r\n" +
|
||||
"QjkWSBLbAimkhZ6Qa6jhquZvUruD1/YpKbtghk/ecxrSDpC8Pqsjl/QjrmkTPWv7\r\n" +
|
||||
"vNihoAMftuR/nAusmBrTkNlzxEBVvRpf4JRsIHg73wUi5zUJkZn7eAZ7kHVa0zow\r\n" +
|
||||
"qflsl7w29guTvqUPP1P1+gH+xD3b3fCM1uRINDDqTyFff6p1hM7Fn9wnapKDmcO7\r\n" +
|
||||
"57QkL8VGNAWknVkBpMYiAmK2R7DlPW5zUleO9M30koNYSIRVwgHiS2Kutd1/gvW7\r\n" +
|
||||
"g5oC+nDLSgQkwgUoonrXzo1bUkE05icf92v89hDVccaXKzVjGgMP407s88++amNV\r\n" +
|
||||
"5J65AgMBAAGjgYEwfzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIE8DBlBgNVHR8EXjBc\r\n" +
|
||||
"MFqgWKBWhlRodHRwOi8vZXZjYS5pdHJ1cy5jb20uY24vcHVibGljL2l0cnVzY3Js\r\n" +
|
||||
"P0NBPTFCRDQyMjBFNTBEQkMwNEIwNkFEMzk3NTQ5ODQ2QzAxQzNFOEVCRDIwDQYJ\r\n" +
|
||||
"KoZIhvcNAQELBQADggEBAABTz0NLnc0bn7InEDVuYMEebEzZv3BxhHVdnzX6R0gQ\r\n" +
|
||||
"Ug0QifHdAtbh/qL10E4FjVACyWOOWgPoX/9I1BZjfxddzQgbUib3XybloR6eE0z3\r\n" +
|
||||
"WUh/B88cCM3GsJU4btaxY0qpTkEjEcqP7K+4ZrJyfCItAfxWqYh6sllGbFVvRSYa\r\n" +
|
||||
"brlEI+lbdlNVnshrRNegtFZIJ40O8aSpNA/2R0+5lEKPeYiQUO4qYbCE3lkPpY9S\r\n" +
|
||||
"p0SMyX0UmB9SIwOFAX+BX3KJ6GBKh+zqSmd0hm4NtbCNRmEG9gYQPl845FdYizKJ\r\n" +
|
||||
"RIk+gkdXBduIpO3/ZkzED/PYMOj/hhJdLNByPe78Ipo=\r\n" +
|
||||
// private static final String CERT ="-----BEGIN CERTIFICATE-----\r\n" +
|
||||
// "MIID3DCCAsSgAwIBAgIUTz/ylkJ1ui0tgyC8gYf7PhjSLf4wDQYJKoZIhvcNAQEL\r\n" +
|
||||
// "BQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsT\r\n" +
|
||||
// "FFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3Qg\r\n" +
|
||||
// "Q0EwHhcNMTkwOTE5MDYzOTI4WhcNMjQwOTE3MDYzOTI4WjBuMRgwFgYDVQQDDA9U\r\n" +
|
||||
// "ZW5wYXkuY29tIHNpZ24xEzARBgNVBAoMClRlbnBheS5jb20xHTAbBgNVBAsMFFRl\r\n" +
|
||||
// "bnBheS5jb20gQ0EgQ2VudGVyMQswCQYDVQQGDAJDTjERMA8GA1UEBwwIU2hlblpo\r\n" +
|
||||
// "ZW4wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCgVuNIZDy2F7UYQw7+\r\n" +
|
||||
// "QjkWSBLbAimkhZ6Qa6jhquZvUruD1/YpKbtghk/ecxrSDpC8Pqsjl/QjrmkTPWv7\r\n" +
|
||||
// "vNihoAMftuR/nAusmBrTkNlzxEBVvRpf4JRsIHg73wUi5zUJkZn7eAZ7kHVa0zow\r\n" +
|
||||
// "qflsl7w29guTvqUPP1P1+gH+xD3b3fCM1uRINDDqTyFff6p1hM7Fn9wnapKDmcO7\r\n" +
|
||||
// "57QkL8VGNAWknVkBpMYiAmK2R7DlPW5zUleO9M30koNYSIRVwgHiS2Kutd1/gvW7\r\n" +
|
||||
// "g5oC+nDLSgQkwgUoonrXzo1bUkE05icf92v89hDVccaXKzVjGgMP407s88++amNV\r\n" +
|
||||
// "5J65AgMBAAGjgYEwfzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIE8DBlBgNVHR8EXjBc\r\n" +
|
||||
// "MFqgWKBWhlRodHRwOi8vZXZjYS5pdHJ1cy5jb20uY24vcHVibGljL2l0cnVzY3Js\r\n" +
|
||||
// "P0NBPTFCRDQyMjBFNTBEQkMwNEIwNkFEMzk3NTQ5ODQ2QzAxQzNFOEVCRDIwDQYJ\r\n" +
|
||||
// "KoZIhvcNAQELBQADggEBAABTz0NLnc0bn7InEDVuYMEebEzZv3BxhHVdnzX6R0gQ\r\n" +
|
||||
// "Ug0QifHdAtbh/qL10E4FjVACyWOOWgPoX/9I1BZjfxddzQgbUib3XybloR6eE0z3\r\n" +
|
||||
// "WUh/B88cCM3GsJU4btaxY0qpTkEjEcqP7K+4ZrJyfCItAfxWqYh6sllGbFVvRSYa\r\n" +
|
||||
// "brlEI+lbdlNVnshrRNegtFZIJ40O8aSpNA/2R0+5lEKPeYiQUO4qYbCE3lkPpY9S\r\n" +
|
||||
// "p0SMyX0UmB9SIwOFAX+BX3KJ6GBKh+zqSmd0hm4NtbCNRmEG9gYQPl845FdYizKJ\r\n" +
|
||||
// "RIk+gkdXBduIpO3/ZkzED/PYMOj/hhJdLNByPe78Ipo=\r\n" +
|
||||
// "-----END CERTIFICATE-----";
|
||||
// private static final String PUBLIC_KEY ="-----BEGIN PUBLIC KEY-----\r\n" +
|
||||
// "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArjSigZVVYy1LzeKmjrJY\r\n" +
|
||||
// "TVh1pS2mYa07hcXOH0vDGBFp8XY1HlJTedTDmYL9pBH/q6PSAf/mvQrXjEbOgFoa\r\n" +
|
||||
// "ro2qEr+SLIze47hxXdZKtgHOKdX6XmjJ9zc1VgB1xHGL339fyOsAz9+lYy1aBClw\r\n" +
|
||||
// "eInkruUBHSudF38dQY43UtHjLoXnrX+CiQCofTqcjbfjVgl/MKcsF6XVajkZ/yOa\r\n" +
|
||||
// "I3kOaQ+YAxB45lAn8vt7rK+VvdkwEf/A1U0+jxwChpdzNlTGMy9qpIWQiILA1Z4+\r\n" +
|
||||
// "9PtWq/3EYxGPKJyxG0PCSGT495v/rAbnYHDt37E4PqslBYBskYLlmQOIh4oltVMX\r\n" +
|
||||
// "wwIDAQAB\r\n" +
|
||||
// "-----END PUBLIC KEY-----";
|
||||
private static final String PUBLIC_KEY ="-----BEGIN PUBLIC KEY-----\\r\\n"+
|
||||
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCA\r\n" +
|
||||
"QEAkXVO04QyRKrCHYxkHjvuWlr0adiFAyDO8yEg5pl9PvIsVsdOd/KElnPlPheIg01rDJFtYv\r\n" +
|
||||
"CavCbYXaIWv1IcNRBtkIP5UERtbRyfuJCO1F/GyybHcnv6amW5Q1xn4cu/IeKV4VzWnDepntJL\r\n" +
|
||||
"bVaBAtw6OSMWBLnk2EuPGa6zNRjvHzdRaZvmAoYu+FZvJLw6oIeeDkR1pGty3CQgnuIe25pQeJ\r\n" +
|
||||
"cAuOWyvC1+ZKvnRbSaS6Hfi8s5mxCQrEiiHEKXHA/rfPp/bDEwqJzA2e/hdnybIII9bcjjqx3l\r\n" +
|
||||
"+9XG5jGHsa7trMedPaeJc96OQUJPm62l9rGG0OZc9+MlsVIskwIDAQAB\r\n"+
|
||||
"-----END PUBLIC KEY-----";
|
||||
private static final String CERT = "-----BEGIN CERTIFICATE-----\r\n"+
|
||||
"MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgE\r\n" +
|
||||
"AAoIBAQCRdU7ThDJEqsIdjGQeO+5aWvRp2IUDIM7zISDmmX0+8ixWx0538oSWc+U+F4iDTW\r\n" +
|
||||
"sMkW1i8Jq8Jthdoha/Uhw1EG2Qg/lQRG1tHJ+4kI7UX8bLJsdye/pqZblDXGfhy78h4pXhX\r\n" +
|
||||
"NacN6me0kttVoEC3Do5IxYEueTYS48ZrrM1GO8fN1Fpm+YChi74Vm8kvDqgh54ORHWka3Lc\r\n" +
|
||||
"JCCe4h7bmlB4lwC45bK8LX5kq+dFtJpLod+LyzmbEJCsSKIcQpccD+t8+n9sMTConMDZ7+F2\r\n" +
|
||||
"fJsggj1tyOOrHeX71cbmMYexru2sx509p4lz3o5BQk+braX2sYbQ5lz34yWxUiyTAgMBAAEC\r\n" +
|
||||
"ggEAfDRYB+L07Y+Fy6dqgiqYn8zUsWDySzaDoDXkmyPrP4mY9MyhI2kRcEssL7X2mm/L/eJc\r\n" +
|
||||
"LkTXS9w7mtBibiHV9jW96M3YYILdkXMEq5u8anoSDLxjSE23CY0tAejwx2ysG2oYo2Qb2S7qh\r\n" +
|
||||
"rR5NbbM2L1mdg2Qqp51W4BBhCOZ4LbNQxPOptPz0hJZAzwzPocmOXM0zP20nBA/Sm/IcjVOcr\r\n" +
|
||||
"HLHYljFxaGg2SvLRlFN9BvnCCGheEy5NvYN/jqPl4cUxoH7S8rzYF/P7xzESha/oaiIStGrpm\r\n" +
|
||||
"SirsyFQI+Wl1I9I9FymUvTPsdlr6YcJ8QuZrxf3Y+0s/gxwSU28Uc4QKBgQDBWedvCPnS5T/\r\n" +
|
||||
"20Y+aZ1wUVAyA1gKQpYzM8Q+5BefaH+Oxpo01wfRWBeFM0oA2w0xaFJuD16lNDOri8qJKNGYoi\r\n" +
|
||||
"HgiRJ/i39ueYZDYuwnSVgLoqwT6cv4wzSvGOOkY0ljXsuOqB8djRSgmNceHoUKmzMOXFfySsAla\r\n" +
|
||||
"RsNsPTyOwwKBgQDAlsdcWPaZ9vhkGzTd2VtQvBX34FOQQajlEClD9PAJYdgNc5DKmd6Vzuh8wE2\r\n" +
|
||||
"5IdWJVBPdNF1j91ZJwcmTeZx5xQd2HLRcZlvoijsNuKPv2ctycVRBZug1ebQWrODC71s8goYHyYd\r\n" +
|
||||
"/ytKf70E4pbzMwdBpkCT9PHVxcG/uhHKt8QKBgQCF6MsllnTXgBity3OGf2FBXviN3ipGnbGHWs\r\n" +
|
||||
"kF3rY11nIu3mfcPGkJjub7+qn7w4TEupL+W8WQbIrdBSgq9mFuXx28tgR574o+Bdp4kAl8WD+Jf\r\n" +
|
||||
"rBi+HNdvys7DL07iKspMGcGon6QHRxyYjq/j4sG1Lf9kqervCmuEWZVN5ASWwKBgDHHx4hLRpLNj6\r\n" +
|
||||
"7wiV2+zSe1Nkh4J6FmF23+G2yBZ3pFXD892/NCipJWhSmZ2307DaMNpITNAEbSq+8stBn2mUewchl\r\n" +
|
||||
"JmiU4IBGfiVwmmdlphnjyakDthKAt8SrbTM2WaRLe+h4RLYEOwBqvEUC/NmoGvwRKSgVbF1BXK9ePT\r\n" +
|
||||
"MVBAoGALyeHwCwOVM6F+CpeHLIvJSni2LmbCyzxxnRdcrMHhxtJWUx0eQTdLqIkVydssphlMDopRR\r\n" +
|
||||
"0FBFdpA/sqo2f39YjAKoaLm01FymxliPcf8tbXQhqDdD8qmQgb58vV5wSh4fCn3mx5y2D/Vwkq3vk\r\n" +
|
||||
"Z0BfEzRREXiOpdJhZdUCG1V8=\r\n"+
|
||||
"-----END CERTIFICATE-----";
|
||||
private static final String PUBLIC_KEY ="-----BEGIN PUBLIC KEY-----\r\n" +
|
||||
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArjSigZVVYy1LzeKmjrJY\r\n" +
|
||||
"TVh1pS2mYa07hcXOH0vDGBFp8XY1HlJTedTDmYL9pBH/q6PSAf/mvQrXjEbOgFoa\r\n" +
|
||||
"ro2qEr+SLIze47hxXdZKtgHOKdX6XmjJ9zc1VgB1xHGL339fyOsAz9+lYy1aBClw\r\n" +
|
||||
"eInkruUBHSudF38dQY43UtHjLoXnrX+CiQCofTqcjbfjVgl/MKcsF6XVajkZ/yOa\r\n" +
|
||||
"I3kOaQ+YAxB45lAn8vt7rK+VvdkwEf/A1U0+jxwChpdzNlTGMy9qpIWQiILA1Z4+\r\n" +
|
||||
"9PtWq/3EYxGPKJyxG0PCSGT495v/rAbnYHDt37E4PqslBYBskYLlmQOIh4oltVMX\r\n" +
|
||||
"wwIDAQAB\r\n" +
|
||||
"-----END PUBLIC KEY-----";
|
||||
|
||||
/**
|
||||
* 数据加密方法
|
||||
@@ -85,7 +118,7 @@ public class RSAEncryptUtil {
|
||||
System.out.println(publicKey);
|
||||
return encodeBase64(encryptPkcs1padding(publicKey, Content.getBytes(CHAR_ENCODING)));
|
||||
}
|
||||
|
||||
|
||||
public static String rsaEncrypt(String Content,String ras) throws Exception {
|
||||
X509Certificate certificate = X509Certificate.getInstance(PUBLIC_KEY.getBytes());
|
||||
PublicKey publicKey = certificate.getPublicKey();
|
||||
@@ -94,4 +127,8 @@ public class RSAEncryptUtil {
|
||||
ci.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||
return encodeBase64(ci.doFinal(Content.getBytes(CHAR_ENCODING)));
|
||||
}
|
||||
|
||||
public static void main(String[] args)throws Exception {
|
||||
System.out.println(rsaEncrypt("orgId=67290416"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,248 @@
|
||||
package cn.pluss.platform.util;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.PublicKey;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author: zph
|
||||
* @Date: 2020/7/10 15:29
|
||||
* @Description: RSA签名验签类
|
||||
*/
|
||||
public class RSASignature{
|
||||
|
||||
/**
|
||||
* 签名算法
|
||||
*/
|
||||
public static final String SIGN_ALGORITHMS = "SHA1WithRSA";
|
||||
|
||||
/**
|
||||
* RSA签名
|
||||
* @param content 待签名数据
|
||||
* @param privateKey 商户私钥
|
||||
* @param encode 字符集编码
|
||||
* @return 签名值
|
||||
*/
|
||||
public static String sign(String content, String privateKey, String encode)
|
||||
{
|
||||
try
|
||||
{
|
||||
PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec( BASE64.decode(privateKey) );
|
||||
|
||||
KeyFactory keyf = KeyFactory.getInstance("RSA");
|
||||
PrivateKey priKey = keyf.generatePrivate(priPKCS8);
|
||||
|
||||
java.security.Signature signature = java.security.Signature.getInstance(SIGN_ALGORITHMS);
|
||||
|
||||
signature.initSign(priKey);
|
||||
signature.update( content.getBytes(encode));
|
||||
|
||||
byte[] signed = signature.sign();
|
||||
|
||||
return BASE64.encode(signed);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 content 和 私钥 生成签名
|
||||
* @param content 按字典顺序排序的内容
|
||||
* @param privateKey ftp上保存的私钥
|
||||
* @return
|
||||
*/
|
||||
public static String sign(String content, String privateKey)
|
||||
{
|
||||
try
|
||||
{
|
||||
PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec( BASE64.decode(privateKey) );
|
||||
KeyFactory keyf = KeyFactory.getInstance("RSA");
|
||||
PrivateKey priKey = keyf.generatePrivate(priPKCS8);
|
||||
java.security.Signature signature = java.security.Signature.getInstance(SIGN_ALGORITHMS);
|
||||
signature.initSign(priKey);
|
||||
signature.update( content.getBytes());
|
||||
byte[] signed = signature.sign();
|
||||
return BASE64.encode(signed);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* RSA验签名检查
|
||||
* @param content 待签名数据
|
||||
* @param sign 签名值
|
||||
* @param publicKey 分配给开发商公钥
|
||||
* @param encode 字符集编码
|
||||
* @return 布尔值
|
||||
*/
|
||||
public static boolean doCheck(String content, String sign, String publicKey,String encode)
|
||||
{
|
||||
try
|
||||
{
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
byte[] encodedKey = BASE64.decode(publicKey);
|
||||
PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey));
|
||||
|
||||
|
||||
java.security.Signature signature = java.security.Signature
|
||||
.getInstance(SIGN_ALGORITHMS);
|
||||
|
||||
signature.initVerify(pubKey);
|
||||
signature.update( content.getBytes(encode) );
|
||||
|
||||
boolean bverify = signature.verify( BASE64.decode(sign) );
|
||||
return bverify;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* RSA验签名检查
|
||||
* @param content 待签名数据
|
||||
* @param sign 签名值
|
||||
* @param publicKey 分配给开发商公钥
|
||||
* @return 布尔值
|
||||
*/
|
||||
public static boolean doCheck(String content, String sign, String publicKey)
|
||||
{
|
||||
try
|
||||
{
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
byte[] encodedKey = BASE64.decode(publicKey);
|
||||
if (encodedKey==null){
|
||||
return false;
|
||||
}
|
||||
PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey));
|
||||
|
||||
// 用私钥对信息生成数字签名
|
||||
java.security.Signature signature = java.security.Signature
|
||||
.getInstance(SIGN_ALGORITHMS);
|
||||
|
||||
signature.initVerify(pubKey);
|
||||
signature.update( content.getBytes() );
|
||||
// 验证方法 返回true则为比对成功
|
||||
boolean bverify = signature.verify( BASE64.decode(sign) );
|
||||
return bverify;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 对象转HashMap
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, Object> objectToMap(Object obj) {
|
||||
if (obj == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
try {
|
||||
Field[] declaredFields = obj.getClass().getDeclaredFields();
|
||||
for (Field field : declaredFields) {
|
||||
field.setAccessible(true);
|
||||
map.put(field.getName(), field.get(obj));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author: zph
|
||||
* @Date: 2020/7/14 17:45
|
||||
* @Description: 将签名的参数内容按参数名的字典顺序进行排序,并拼接为字符串
|
||||
*/
|
||||
public static String getContent(Map<String,Object> map){
|
||||
//得到第三方签名 第三方会把sign也放在json里,故转map的时候需要把sign删除
|
||||
map.remove("sign");
|
||||
map.entrySet().removeIf(entry -> entry.getValue() == null);
|
||||
// 将签名的参数内容按参数名的字典顺序进行排序,并拼接为字符串
|
||||
StringBuilder sb = new StringBuilder();
|
||||
map.entrySet().stream().sorted(Comparator.comparing(Map.Entry::getKey)).forEach(entry ->
|
||||
sb.append(entry.getKey()).append("=").append(entry.getValue()).append("&")
|
||||
);
|
||||
return sb.toString().substring(0, sb.length() - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 签名方法
|
||||
* 因为很多处都需要用,特地封装一下,方便调用
|
||||
* @param paramStr 按字典顺序拼接过的字符串
|
||||
* @param publicKey 从数据库查询出来的第三方公钥
|
||||
* @param sign 第三方签名
|
||||
* @return
|
||||
*/
|
||||
public static boolean signVerify(String paramStr,String publicKey,String sign){
|
||||
System.err.println(paramStr);
|
||||
try {
|
||||
//String privateSign = RSASignature.sign(paramStr, RSAEncrypt.loadPrivateKeyByFile());
|
||||
// 使用公钥进行验签
|
||||
boolean result = RSASignature.doCheck(paramStr, sign, publicKey);
|
||||
if (result){
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// public static void main(String[] args) {
|
||||
// try {
|
||||
// // 生成密钥对
|
||||
// KeyPair keyPair = getKeyPair();
|
||||
// String privateKey = new String(Base64.encodeBase64(keyPair.getPrivate().getEncoded()));
|
||||
// String publicKey = new String(Base64.encodeBase64(keyPair.getPublic().getEncoded()));
|
||||
// System.out.println("私钥:" + privateKey);
|
||||
// System.out.println("公钥:" + publicKey);
|
||||
// // RSA加密
|
||||
// String data = "待加密的文字内容";
|
||||
// String encryptData = encrypt(data, getPublicKey(publicKey));
|
||||
// System.out.println("加密后内容:" + encryptData);
|
||||
// // RSA解密
|
||||
// String decryptData = decrypt(encryptData, getPrivateKey(privateKey));
|
||||
// System.out.println("解密后内容:" + decryptData);
|
||||
//
|
||||
// // RSA签名
|
||||
// String sign = sign(data, getPrivateKey(privateKey));
|
||||
// // RSA验签
|
||||
// boolean result = verify(data, getPublicKey(publicKey), sign);
|
||||
// System.out.print("验签结果:" + result);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// System.out.print("加解密异常");
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
package cn.pluss.platform.util;
|
||||
|
||||
|
||||
import org.apache.tomcat.util.codec.binary.Base64;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.KeyPair;
|
||||
import java.security.KeyPairGenerator;
|
||||
import java.security.interfaces.RSAPrivateKey;
|
||||
import java.security.interfaces.RSAPublicKey;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @date 2021/4/28 15:02
|
||||
*/
|
||||
public class RSAUtil {
|
||||
|
||||
public static String RSA_ALGORITHM = "SHA1WithRSA";
|
||||
public static String UTF8 = "UTF-8";
|
||||
|
||||
public static final String PUBLIC_KEY ="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCKjak6oTfMxO3hWZ8CnMgUxDXHtsHQLZf4GgxzbjVYIN93UtuycdHypfUEh18s8sWwHRvBfeJ4mG0QbLazMphUY7ju9ox/qyB+tmJtZO5fCUi1StnSh17fJRw2kBlD9dKtBBKHJw0PXC/d6ATRtbbbFerzgLtUz70SvUxooUQHtQIDAQAB";
|
||||
public static final String CERT ="MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAIqNqTqhN8zE7eFZnwKcyBTENce2wdAtl/gaDHNuNVgg33dS27Jx0fKl9QSHXyzyxbAdG8F94niYbRBstrMymFRjuO72jH+rIH62Ym1k7l8JSLVK2dKHXt8lHDaQGUP10q0EEocnDQ9cL93oBNG1ttsV6vOAu1TPvRK9TGihRAe1AgMBAAECgYBmI8KCl0DkcrSOsRvYuC2DqZWf8el1B3eFjeZp3e/zVOCIPYv6Q5ArWg6DVSxjnWEA0KSagqvGjU+xkQMqnXzPcPMhsIS+1wyR/pP+pwiatO2ioHaQpEqHg9eXhxrgA477/xuKVw9zl5GNqaIgd++2NDXnqLh0Y6OR73f0OB5eDQJBAPihEm+UWLOam/Q/k2+k4Lm2dvxJTBur1fslBiJpgMhgcz/PlwRwpL7aPD0AuPv0NqLouuoTiKpq9icnUv12tgsCQQCOqTANw0IErCHUNdinjXewmG3ui1j9XgM41rSn5ZeTrPL4GhZc2zbS/pZT4PBKUL6NLGkfPHmw4rOmNL/Xc5E/AkBqAwQBX5eSvVHSC2mqKPtJNGv3lqlFAzfyJg8/jQzEY5vAkZsq4Xzdg+A7gptdkvvY6rMIK9wSDhl3CGVyfbORAkA1N+g1OiHmnFACWhP4bU25EyPvWQxZeDi7e1zpRTzGWj5JT3IIMb7B9zcdE0yQbI6pG2gbvvOmiOt7lTH7raEBAkBas2gugvR3f0aGqQcqMpyM627pyRppQ2h58/7KBylP3oR2BReqMUcXeiJ8TuBXzbRXpeVQ0DWOva5CWZJmBMdz";
|
||||
|
||||
/**
|
||||
* 创建公钥私钥
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static KeyStore createKeys() throws Exception {
|
||||
KeyPairGenerator keyPairGeno = KeyPairGenerator.getInstance(RSA_ALGORITHM);
|
||||
keyPairGeno.initialize(1024);
|
||||
KeyPair keyPair = keyPairGeno.generateKeyPair();
|
||||
|
||||
RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
|
||||
RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
|
||||
|
||||
KeyStore keyStore = new KeyStore();
|
||||
keyStore.setPublicKey(Base64.encodeBase64String(publicKey.getEncoded()));
|
||||
keyStore.setPrivateKey(Base64.encodeBase64String(privateKey.getEncoded()));
|
||||
return keyStore;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取公钥对象
|
||||
*
|
||||
* @param pubKeyData
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static RSAPublicKey getPublicKey(byte[] pubKeyData) throws Exception {
|
||||
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(pubKeyData);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
|
||||
return (RSAPublicKey) keyFactory.generatePublic(keySpec);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取公钥对象
|
||||
*
|
||||
* @param pubKey 公钥
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static RSAPublicKey getPublicKey(String pubKey) throws Exception {
|
||||
return getPublicKey(Base64.decodeBase64(pubKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取私钥对象
|
||||
*
|
||||
* @param priKey
|
||||
* 私钥
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static RSAPrivateKey getPrivateKey(String priKey) throws Exception {
|
||||
return getPrivateKey(Base64.decodeBase64(priKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过私钥byte[]将公钥还原,适用于RSA算法
|
||||
*
|
||||
* @param keyBytes
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static RSAPrivateKey getPrivateKey(byte[] keyBytes) throws Exception {
|
||||
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
|
||||
return (RSAPrivateKey) keyFactory.generatePrivate(keySpec);
|
||||
|
||||
}
|
||||
|
||||
public static String encryptByPublicKey(String data, String publicKey) throws Exception {
|
||||
return encryptByPublicKey(data, getPublicKey(publicKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* 公钥加密
|
||||
*
|
||||
* @param data
|
||||
* @param publicKey
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String encryptByPublicKey(String data, RSAPublicKey publicKey) throws Exception {
|
||||
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||
byte[] bytes = cipher.doFinal(data.getBytes(UTF8));
|
||||
return Base64.encodeBase64String(bytes);
|
||||
}
|
||||
|
||||
public static String decryptByPublicKey(String data, String rsaPublicKey) throws Exception {
|
||||
return decryptByPublicKey(data, getPublicKey(rsaPublicKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* 公钥解密
|
||||
*
|
||||
* @param data
|
||||
* @param rsaPublicKey
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String decryptByPublicKey(String data, RSAPublicKey rsaPublicKey) throws Exception {
|
||||
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
|
||||
cipher.init(Cipher.DECRYPT_MODE, rsaPublicKey);
|
||||
byte[] inputData = Base64.decodeBase64(data);
|
||||
byte[] bytes = cipher.doFinal(inputData);
|
||||
return new String(bytes, UTF8);
|
||||
}
|
||||
|
||||
public static String encryptByPrivateKey(String data, String privateKey) throws Exception {
|
||||
return encryptByPrivateKey(data, getPrivateKey(privateKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* 私钥加密
|
||||
*
|
||||
* @param data
|
||||
* @param privateKey
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String encryptByPrivateKey(String data, RSAPrivateKey privateKey) throws Exception {
|
||||
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
|
||||
byte[] bytes = cipher.doFinal(data.getBytes(UTF8));
|
||||
return Base64.encodeBase64String(bytes);
|
||||
}
|
||||
|
||||
public static String decryptByPrivateKey(String data, String privateKey) throws Exception {
|
||||
return decryptByPrivateKey(data, getPrivateKey(privateKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* 私钥解密
|
||||
*
|
||||
* @param data
|
||||
* @param privateKey
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String decryptByPrivateKey(String data, RSAPrivateKey privateKey) throws Exception {
|
||||
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
|
||||
cipher.init(Cipher.DECRYPT_MODE, privateKey);
|
||||
byte[] inputData = Base64.decodeBase64(data);
|
||||
byte[] bytes = cipher.doFinal(inputData);
|
||||
return new String(bytes, UTF8);
|
||||
}
|
||||
|
||||
|
||||
public static class KeyStore {
|
||||
private String publicKey;
|
||||
private String privateKey;
|
||||
|
||||
public String getPublicKey() {
|
||||
return publicKey;
|
||||
}
|
||||
|
||||
public void setPublicKey(String publicKey) {
|
||||
this.publicKey = publicKey;
|
||||
}
|
||||
|
||||
public String getPrivateKey() {
|
||||
return privateKey;
|
||||
}
|
||||
|
||||
public void setPrivateKey(String privateKey) {
|
||||
this.privateKey = privateKey;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
//KeyStore keyPair = RSAUtil.createKeys();
|
||||
// String publickey=keyPair.getPublicKey();
|
||||
// String privateKey=keyPair.getPrivateKey();
|
||||
System.out.println("公钥:" + PUBLIC_KEY);
|
||||
System.out.println("私钥:" + CERT);
|
||||
String encode=RSAUtil.encryptByPublicKey("1111",PUBLIC_KEY);
|
||||
System.out.println("加密数据:"+encode);
|
||||
System.out.println("解密数据:"+RSAUtil.decryptByPrivateKey(encode,CERT));
|
||||
|
||||
|
||||
// String privateKey="MIICdAIBADANBgkqhkiG9w0BAQEFAASCAl4wggJaAgEAAoGBAJ81T1tVomxy1ncvqUxP3hAhLf+1Iajaan2j3J3NcwVvI9Mr96wgqg3D4mWQ3ngjRySHf1d7L5wcf4LNgox88ePjTF0i1rsneRsNnYIwt4NCAvDairM6LuRMrcneulVD7q7aoOzjSl4PcRUQbmyRou1LGykEzmbj/bK7aPE/gmMJAgMBAAECgYBRkhTIrQV9HxF3G3pYWQtjpDxXKUzHoLCzEsO0LlFiVWE7julkzY+TYeubMjBpyVloA+xgvALWr1s9f2IF7PZZh3eJO8YrIQCPhz3uX8m/3Yt+t7yu/Ju0EtdwVC9CYcoBx9MaxaPAmviy8Fmt8rFTX5v3AKB1NrydBgkF1j3tSQJBAMvLSYBH8bqd3bN+pajdaqzbA+8hpsyxITEj5fk8lsc34nwiDq7xp9Z2CLDG8FSmRZEUBTaXt6OnFWYSrTl56dcCQQDH/hsJGwwI/8UfV+RmnDTrQGGiXIJUzKKgAJ47GNfeAlNJELYYqtIi5Dj/LMggBWg2F1/ZEwko/q5E3mLkKz4fAkAhIGlRNeCgQhsQm0yYV22IrY1FKMYxTbWkhD5UtjmYJohlPy/91gA/Ry6AdcYJLIHwZD24sw7Bxl4fGngX+K4/Aj8CV/f5I1gAwv6MX3tNuIbmOtrqDCt60usU9OzlxGTDNUPEl22K3HWZ8xK36s5tkaKm/58f7BkvYcypAfImulsCQBRkLBcHXyGhbH0gfjQT9lfWSMBbv3oKfDlrxLDKb0eZr7AtBTDqfubq52yh1cH4kvzkn8eLBVnBTcdKi48gMM0=";
|
||||
// System.out.println("解密数据:"+RSAUtil.decryptByPrivateKey("fy1w9GHsrpwJzs4RW2KSZhB8gU4B2gJ3Gc1yLi5Hi0aniDiWYF95VwgNw3tjLzuDIEzoCEUDUphxK2rVmWZl4ORU3ooS+57TLhN5xb/WuhEo9RmKwm6CJHUUKxms3RoRUHk6r9hOhA4Irdqp2V/fIWQUlwp0HWytUqx912D53fs=",privateKey));
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,8 @@ import javax.crypto.spec.SecretKeySpec;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.*;
|
||||
|
||||
import static cn.pluss.platform.util.RSAUtil.encryptByPublicKey;
|
||||
|
||||
/**
|
||||
* AES加密工具类
|
||||
*
|
||||
@@ -27,7 +29,7 @@ public class TokenUtil {
|
||||
private static final String APP_SECRET = "2022bsjZF544GAH";
|
||||
//sn
|
||||
private static final String SN = "BSJQG01YJ0001";
|
||||
|
||||
public static final String PUBLIC_KEY ="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCKjak6oTfMxO3hWZ8CnMgUxDXHtsHQLZf4GgxzbjVYIN93UtuycdHypfUEh18s8sWwHRvBfeJ4mG0QbLazMphUY7ju9ox/qyB+tmJtZO5fCUi1StnSh17fJRw2kBlD9dKtBBKHJw0PXC/d6ATRtbbbFerzgLtUz70SvUxooUQHtQIDAQAB";
|
||||
/**
|
||||
* 获取TOKEN值
|
||||
* @param timestamp 时间戳,13位
|
||||
@@ -56,14 +58,42 @@ public class TokenUtil {
|
||||
finalMap.put("TOKEN", MD5Util.md5(token + APP_SECRET).toUpperCase());
|
||||
return finalMap;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
public static Map<String, String> getToken(String timestamp, String requestId, String appId, String reqData)throws Exception {
|
||||
String token = "";
|
||||
String encode = "";
|
||||
System.out.println(timestamp);
|
||||
System.out.println(requestId);
|
||||
System.out.println(appId);
|
||||
System.out.println(reqData);
|
||||
SortedMap<String, Object> map = new TreeMap();
|
||||
map.put("appId", appId);
|
||||
map.put("timestamp", timestamp);
|
||||
map.put("requestId", requestId);
|
||||
map.put("reqData", reqData);
|
||||
Iterator<Map.Entry<String, Object>> iterator = map.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<String, Object> next = iterator.next();
|
||||
String key = next.getKey();
|
||||
Object value = next.getValue();
|
||||
token += key + value;
|
||||
encode += key + "=" + value + "&";
|
||||
}
|
||||
System.out.println(token);
|
||||
Map<String, String> finalMap = new HashMap<>();
|
||||
finalMap.put("ENCODE",encode);
|
||||
finalMap.put("TOKEN", RSASignature.sign(encode, RSAUtil.CERT));
|
||||
return finalMap;
|
||||
}
|
||||
public static void main(String[] args) throws Exception{
|
||||
String s = String.valueOf(System.currentTimeMillis());
|
||||
System.out.println(s);
|
||||
String s1 = UUID.randomUUID().toString();
|
||||
System.out.println(s1);
|
||||
Map<String, String> token = getToken(s, s1,APP_SECRET);
|
||||
String param = "{\"ordNo\":\"2017031601582703488262843972\",\"mno\":\"399190513665034\"}";
|
||||
Map<String, String> token = getToken(s, s1, APP_SECRET, param);
|
||||
System.out.println(token);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ public class YtCreateOrder implements Serializable {
|
||||
|
||||
|
||||
public YtCreateOrder() {
|
||||
this.senderName = "快银收银客服部";
|
||||
this.senderName = "银收客客服部";
|
||||
this.senderProvinceName = "陕西省";
|
||||
this.senderCityName = "西安市";
|
||||
this.senderCountyName = "未央区";
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<div class="layui-layout layui-layout-admin">
|
||||
<div class="layui-header">
|
||||
<div class="layui-logo">
|
||||
快银系统
|
||||
银收客系统
|
||||
</div>
|
||||
<ul class="layui-nav layui-layout-right">
|
||||
<li style="float: left">
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
<div class="layui-side layui-side-menu">
|
||||
<div class="layui-side-scroll">
|
||||
<div class="layui-logo" lay-href="home/console.html">
|
||||
<span>快银管理平台</span>
|
||||
<span>银收客管理平台</span>
|
||||
</div>
|
||||
|
||||
<div class="layui-side layui-bg-black">
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
</div>
|
||||
<!-- BEGIN LOGO -->
|
||||
<div class="logo">
|
||||
<div>快银平台</div>
|
||||
<div>银收客平台</div>
|
||||
</div>
|
||||
<!-- END LOGO -->
|
||||
<!-- BEGIN LOGIN -->
|
||||
|
||||
@@ -64,8 +64,8 @@ public class DeviceMerchantBuyDTO {
|
||||
|
||||
public Map<String, String> convert(String orderNo) {
|
||||
Map<String, String> result = new HashMap<String, String>(16);
|
||||
result.put("body", "快银收银商品订单支付");
|
||||
result.put("subject", "快银收银商品订单支付");
|
||||
result.put("body", "银收客商品订单支付");
|
||||
result.put("subject", "银收客商品订单支付");
|
||||
result.put("outTradeNo", orderNo);
|
||||
result.put("totalAmount", orderAmount + "");
|
||||
return result;
|
||||
|
||||
@@ -88,5 +88,7 @@ public class AppGuide implements Serializable {
|
||||
*/
|
||||
@TableField(select = false, value = "updateTime", condition = SqlConditionExtra.LT)
|
||||
private Date updateTimeEnd;
|
||||
@TableField("type")
|
||||
private String type;
|
||||
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public class DeviceOperateInfoVO extends DeviceOperateInfo {
|
||||
public String getDesc() {
|
||||
String type = this.getType();
|
||||
if(DeviceOperateType.IN.getCode().equals(type)){
|
||||
this.desc = "快银收银设备入库";
|
||||
this.desc = "银收客设备入库";
|
||||
}
|
||||
if(DeviceOperateType.TRANSFER.getCode().equals(type)){
|
||||
this.desc = this.getRemark();
|
||||
|
||||
@@ -50,7 +50,7 @@ public class DeviceTransferVO extends DeviceTransfer {
|
||||
|
||||
public String getUserName() {
|
||||
if(StringUtil.isEmpty(this.userName)){
|
||||
this.userName = "快银收银";
|
||||
this.userName = "银收客";
|
||||
}
|
||||
return userName;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class AgentStaffMainPageServiceImpl implements MainPageService {
|
||||
Double promoteConsumeFee;
|
||||
Integer totalOrderCount;
|
||||
|
||||
//快银收银
|
||||
//银收客
|
||||
Map<String, Object> queryMap = new HashMap<>();
|
||||
queryMap.put("userId", queryUserApp.getParentId());
|
||||
queryMap.put("agentStaffId", userId);
|
||||
|
||||
@@ -92,7 +92,7 @@ public class CashServiceImpl extends ServiceImpl<CashMapper, Cash> implements Ca
|
||||
RiskBlacklist entity = rbService.getOne(new QueryWrapper<>(condition));
|
||||
|
||||
if (entity != null) {
|
||||
throw new MsgException("该账户存在重大违规行为,暂不支持提现,请联系快银收银客服申诉");
|
||||
throw new MsgException("该账户存在重大违规行为,暂不支持提现,请联系银收客客服申诉");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -516,7 +516,7 @@ public class CashServiceImpl extends ServiceImpl<CashMapper, Cash> implements Ca
|
||||
|
||||
alipayService.remit(accountNo, accountName, cash.getVirRealCashAmt().toString());
|
||||
// 发送分润打款通知
|
||||
generalPushUtil.sendAllPlatByAlias(Collections.singletonList(cash.getUserId() + ""), "快银收银分润到账通知", "您的分润已结算至支付宝,快去查看哦!", "1");
|
||||
generalPushUtil.sendAllPlatByAlias(Collections.singletonList(cash.getUserId() + ""), "银收客分润到账通知", "您的分润已结算至支付宝,快去查看哦!", "1");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -119,7 +119,7 @@ public class MercAuditListenerImpl implements MercAuditListener {
|
||||
public void onFail(String userId, MerchantChannelStatus mcs, String msg) {
|
||||
MerchantBaseInfo mbi = mbiMapper.queryByMerchantCode(mcs.getMerchantCode());
|
||||
|
||||
String title2 = "快银收银审核通知";
|
||||
String title2 = "银收客审核通知";
|
||||
|
||||
String msg2;
|
||||
|
||||
@@ -141,7 +141,7 @@ public class MercAuditListenerImpl implements MercAuditListener {
|
||||
public void onSuccess(String userId, MerchantChannelStatus mcs) {
|
||||
MerchantBaseInfo mbi = mbiMapper.queryByMerchantCode(mcs.getMerchantCode() + "");
|
||||
|
||||
String title = "快银收银审核通知";
|
||||
String title = "银收客审核通知";
|
||||
String msg;
|
||||
if (Objects.equals(mcs.getChannel(), 4)) {
|
||||
msg = "商户D0进件通过,完成支付宝及微信认证后即可支持相应渠道收款";
|
||||
|
||||
@@ -899,7 +899,7 @@ public class YSAuditServiceV3 implements cn.pluss.platform.channel.ys.YSAuditSer
|
||||
UserApp userApp = userAppMapper.selectOne(qWrapper2);
|
||||
|
||||
String pushMsg = "D0通道" + flagName + typeName + "报备失败,请联系客服进行处理";
|
||||
sxfMerAuditHandler.sendNotice(userApp, "快银收银审核通知", pushMsg, mcs.getApplicationId());
|
||||
sxfMerAuditHandler.sendNotice(userApp, "银收客审核通知", pushMsg, mcs.getApplicationId());
|
||||
}
|
||||
|
||||
if (Objects.equals("00", status)) {
|
||||
|
||||
@@ -190,6 +190,10 @@ public class BankCardServiceImpl extends ServiceImpl<BankCardMapper, BankCard> i
|
||||
bankName = "浦东发展";
|
||||
}
|
||||
|
||||
if("长安".equals(bankName)){
|
||||
bankName="城市商业银行";
|
||||
}
|
||||
|
||||
if (!bankCodeSxf.getBankName().contains(bankName) && !"其他".equals(bankName)) {
|
||||
MsgException.throwException("开户行与支行信息不匹配,请检查银行卡信息");
|
||||
}
|
||||
|
||||
@@ -46,13 +46,13 @@ public class PushServiceImpl extends ServiceImpl<PushAllMapper, PushAll> impleme
|
||||
|
||||
switch (type) {
|
||||
case MAKE_ORDER:
|
||||
generalPushUtil.sendAllPlatByAlias(alias, "快银收银", "快银收银线上店订单来了请及时处理", "3");
|
||||
generalPushUtil.sendAllPlatByAlias(alias, "银收客", "银收客线上店订单来了请及时处理", "3");
|
||||
break;
|
||||
case URGE_ORDER:
|
||||
generalPushUtil.sendAllPlatByAlias(alias, "快银收银", "您有一笔催单请及时处理", "3");
|
||||
generalPushUtil.sendAllPlatByAlias(alias, "银收客", "您有一笔催单请及时处理", "3");
|
||||
break;
|
||||
case REQUEST_SERVICE:
|
||||
generalPushUtil.sendAllPlatByAlias(alias, "快银收银", "您有一个新的呼叫服务请及时处理", "3");
|
||||
generalPushUtil.sendAllPlatByAlias(alias, "银收客", "您有一个新的呼叫服务请及时处理", "3");
|
||||
break;
|
||||
case REFUND_ORDER:
|
||||
generalPushUtil.sendAllPlatByAlias(alias, "收银呗", "您有一笔未接单的线上店订单,客户已申请退款。", "2");
|
||||
|
||||
@@ -12,7 +12,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 快银收银缴费通收款单 服务类
|
||||
* 银收客缴费通收款单 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author crystal
|
||||
|
||||
@@ -230,7 +230,7 @@ public class MerchantMenberServiceImpl extends ServiceImpl<MerchantMenberMapper,
|
||||
String unionid = jsonObject.getString("unionid");
|
||||
String avatar = jsonObject.getString("avatar");
|
||||
if(StringUtil.isEmpty(memberName) || memberName == "undefined"){
|
||||
memberName = "快银收银会员"+StringUtil.genRandomNum(6);
|
||||
memberName = "银收客会员"+StringUtil.genRandomNum(6);
|
||||
}
|
||||
if(StringUtil.isEmpty(avatar) || avatar == "undefined"){
|
||||
avatar = default_avatar;
|
||||
|
||||
@@ -2008,7 +2008,7 @@ public class MerchantOrderServiceImpl extends ServiceImpl<MerchantOrderMapper, M
|
||||
try {
|
||||
Notice notice = new Notice(2,98,userApp);
|
||||
notice.setUniqueKey(order.getOrderNumber()+userApp.getUserId());
|
||||
String content = "快银到账" + order.getConsumeFee() + "元";
|
||||
String content = "银收客到账" + order.getConsumeFee() + "元";
|
||||
notice.setConrtent(content);
|
||||
noticeService.saveOrUpdate(notice);
|
||||
// 会员充值播报
|
||||
|
||||
@@ -123,7 +123,7 @@ public class RyxPayServiceimpl implements RyxPayService {
|
||||
if(!RyxConfig.PAY_SUCCESS_CODE.equals(respCode)){
|
||||
result.put("code",ResultCode.FAIL.code());
|
||||
if(respMsg.contains("商户需补齐相关资料")){
|
||||
result.put("msg","D0实时到账:商户未在快银收银APP-商户认证-微信认证(支付宝认证)内完成授权,暂时无法收款");
|
||||
result.put("msg","D0实时到账:商户未在银收客APP-商户认证-微信认证(支付宝认证)内完成授权,暂时无法收款");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ public class SxfPayServiceImpl implements SxfPayService {
|
||||
if (respData.get("bizMsg").toString().contains("使用微信支付")) {
|
||||
result.put("msg", "云闪付/京东支付失败:同一支付通道下一张身份证最多注册一个小微商户");
|
||||
} else if (respData.get("bizMsg").toString().contains("商户需补齐相关资料") || respData.get("bizMsg").toString().contains("微信实名认证")) {
|
||||
result.put("msg", "D0实时到账:商户未在快银收银APP-商户认证-微信认证(支付宝认证)内完成授权,暂时无法收款");
|
||||
result.put("msg", "D0实时到账:商户未在银收客APP-商户认证-微信认证(支付宝认证)内完成授权,暂时无法收款");
|
||||
} else {
|
||||
result.put("msg", respData.get("bizMsg"));
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public class YsChangeRateServiceImpl extends BaseMchChannelRateNewService {
|
||||
rateNewRecordService.save(mrnr);
|
||||
|
||||
// 上传一张空白图作为结算信息修改申请表
|
||||
((YsAuditServiceImpl) ysAuditServiceV2).imageUploadEdit("https://www.shouyinbei.net/resources快银收银s/upload/blank.png", "B008", changeFlowId);
|
||||
((YsAuditServiceImpl) ysAuditServiceV2).imageUploadEdit("https://www.shouyinbei.net/resources银收客s/upload/blank.png", "B008", changeFlowId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -318,7 +318,7 @@ public class YsAuditServiceImpl extends AbstractYsResultService {
|
||||
} else {
|
||||
param.put(YsConstant.BALANCE_ACC_TYPE, "11");
|
||||
}
|
||||
param.put(YsConstant.EXPANDING_MANAGER, "快银收银");
|
||||
param.put(YsConstant.EXPANDING_MANAGER, "银收客");
|
||||
|
||||
// 这里在进件之前再加一次校验
|
||||
preCheck(userId);
|
||||
|
||||
@@ -250,7 +250,7 @@ public class YsCertServiceImpl implements MerchantCertService {
|
||||
|
||||
MerchantBaseInfo mbi = mbiService.getMerchantBaseInfoByMerchantCode(mcs.getMerchantCode());
|
||||
|
||||
String pushMsg = "您好!您的商户微信认证因“##”被驳回,请联系快银收银客服修改资料并重新审核";
|
||||
String pushMsg = "您好!您的商户微信认证因“##”被驳回,请联系银收客客服修改资料并重新审核";
|
||||
pushMsg = pushMsg.replace("##", wxCertResult.getString("reject_reason"));
|
||||
generalPushUtil.sendAllPlatByAlias(Collections.singletonList(mbi.getUserId()), "商户微信认证通知", pushMsg, "1");
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ public class YsPayOldServiceImpl extends YsPayServiceImpl{
|
||||
String sub_code = respData.getString("sub_code");
|
||||
String sub_msg = respData.getString("sub_msg");
|
||||
if("4335".equals(sub_code) && StringUtil.isNotEmpty(sub_msg) && sub_msg.contains("商户需补齐相关资料")){
|
||||
MsgException.throwException("D0实时到账:商户未在快银收银APP-商户认证-微信认证(支付宝认证)内完成授权,暂时无法收款");
|
||||
MsgException.throwException("D0实时到账:商户未在银收客APP-商户认证-微信认证(支付宝认证)内完成授权,暂时无法收款");
|
||||
}else if("4335".equals(sub_code) && StringUtil.isNotEmpty(sub_msg) && sub_msg.contains("金额超限")){
|
||||
MsgException.throwException("单笔交易金额超限");
|
||||
}else{
|
||||
|
||||
@@ -371,7 +371,7 @@ public class WechantController {
|
||||
backMsgXml.append("<FromUserName><![CDATA["+(String) map.get("ToUserName")+"]]></FromUserName>");
|
||||
backMsgXml.append("<CreateTime>"+System.currentTimeMillis()+"</CreateTime>");
|
||||
backMsgXml.append("<MsgType><![CDATA[text]]></MsgType>");
|
||||
backMsgXml.append("<Content><![CDATA[你好,欢迎关注快银收银!]]></Content>");
|
||||
backMsgXml.append("<Content><![CDATA[你好,欢迎关注银收客!]]></Content>");
|
||||
backMsgXml.append("</xml>");
|
||||
response.setContentType("text/xml; charset=utf-8");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
|
||||
@@ -269,7 +269,7 @@
|
||||
<img src="https://www.shouyinbei.net/resources/images/logo.png"/>
|
||||
</div>
|
||||
<div class="abl-text">
|
||||
绑定您的快银账户
|
||||
绑定您的银收客账户
|
||||
</div>
|
||||
</div>
|
||||
<div class="account-binding-form">
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
<div class="account-logo">
|
||||
<img src="https://www.shouyinbei.net/resources/images/logo.png" alt="">
|
||||
</div>
|
||||
<div class="account-title">收款就用快银</div>
|
||||
<div class="account-title">收款就用银收客</div>
|
||||
<div class="account-con-list">
|
||||
<div class="account-list" th:each="user:${list}">
|
||||
<div class="account-name" th:text="${user.alias}"></div>
|
||||
|
||||
@@ -244,7 +244,7 @@
|
||||
</div>
|
||||
<div class="payinfo" id="payinfo">
|
||||
<div class="shouyin" onclick="showInput()">
|
||||
<p>智 慧 经 营 就 用 快 银</p>
|
||||
<p>智 慧 经 营 就 用 银 收 客</p>
|
||||
</div>
|
||||
<table cellspacing="0" cellpadding="0" id="table1">
|
||||
<tr>
|
||||
|
||||
@@ -61,9 +61,9 @@
|
||||
<body style="height: auto;">
|
||||
<div id="app" class="">
|
||||
<div id="adminRewardIntro">
|
||||
<p>1.新用户是指首次注册快银的用户;</p>
|
||||
<p>1.新用户是指首次注册银收客的用户;</p>
|
||||
<p>2.每日获得的分润次日即可在账户中提现;</p>
|
||||
<p>3.由于不可抗力(包括但不限于服务器意外关机、网络意外中断、快银平台受到恶意攻击及磁盘意外损坏)而导致交易数据丢失的情况不计算奖励金额;</p>
|
||||
<p>3.由于不可抗力(包括但不限于服务器意外关机、网络意外中断、银收客平台受到恶意攻击及磁盘意外损坏)而导致交易数据丢失的情况不计算奖励金额;</p>
|
||||
<p>5.活动暂停或取消前发生的交易金额仍按照规则比例计算并结算奖励金,活动暂停或取消后发生的交易金额不再计算奖励金。但如果活动由于监管等原因被强制暂停,奖励金将停止发放。</p>
|
||||
<p><b>奖励详情</b></p>
|
||||
<p>1.用户A通过本活动邀请好友B开通收银呗业务,B邀请好友C开通收银呗业务等。</p>
|
||||
|
||||
@@ -61,13 +61,13 @@
|
||||
<body style="height: auto;">
|
||||
<div id="app" class="">
|
||||
<div id="adminRules">
|
||||
<h2>快银用户邀请活动规则</h2>
|
||||
<h2>银收客用户邀请活动规则</h2>
|
||||
<p>一、参与方式</p>
|
||||
<p>快银用户在知悉并确认接受本邀请规则的情况下,自愿参与本活动。</p>
|
||||
<h3>用户邀请的好友经审核通过开通快银业务(“开通”指经快银平台合作收单机构复审通过且实现收款功能),该用户即可获得相应的邀请奖励。</h3>
|
||||
<p>银收客用户在知悉并确认接受本邀请规则的情况下,自愿参与本活动。</p>
|
||||
<h3>用户邀请的好友经审核通过开通银收客业务(“开通”指经银收客平台合作收单机构复审通过且实现收款功能),该用户即可获得相应的邀请奖励。</h3>
|
||||
<p>二、邀请奖励规则</p>
|
||||
<p>(一)奖励详情</p>
|
||||
<p>1.用户A通过本活动邀请好友B开通快银业务,B邀请好友C开通快银业务等。 </p>
|
||||
<p>1.用户A通过本活动邀请好友B开通银收客业务,B邀请好友C开通银收客业务等。 </p>
|
||||
<p>2.净收款交易金额(收款金额-退款金额)。 </p>
|
||||
<p>3.A可以通过邀请好友升级</p>
|
||||
<p class="indent">1) V1等级(注册即为V1)</p>
|
||||
@@ -84,8 +84,8 @@
|
||||
<p>3.团队奖励</p>
|
||||
<p class="indent">1)A可获得B团队的净收款交易金额的费率差分润;</p>
|
||||
<p>例如:</p>
|
||||
<p class="indent">1) A邀请${oneLevel}个好友开通快银,A商户交易费率降至${oneRate}%,每交易1万省8元;</p>
|
||||
<p class="indent">2) A邀请${twoLevel}个好友开通快银,A商户交易费率降至${twoRate}%,每交易1万省13元;</p>
|
||||
<p class="indent">1) A邀请${oneLevel}个好友开通银收客,A商户交易费率降至${oneRate}%,每交易1万省8元;</p>
|
||||
<p class="indent">2) A邀请${twoLevel}个好友开通银收客,A商户交易费率降至${twoRate}%,每交易1万省13元;</p>
|
||||
<p class="indent">3) A=V1,B每月净收款交易金额100万元,A每月奖励分润为100万*0.06%=600元;</p>
|
||||
<p class="indent">4) A=V2,B每月净收款交易金额100万元,A每月奖励分润为100万*0.08%=800元;</p>
|
||||
<p class="indent">5) A=V3,B每月净收款交易金额100万元,A每月奖励分润为100万*0.1%=1000元;</p>
|
||||
@@ -94,21 +94,21 @@
|
||||
<p>三、活动时间</p>
|
||||
<p>${actStartDate}-${actEndDate}</p>
|
||||
<p>四、活动须知</p>
|
||||
<p>1. 该活动为持续性活动,如用户已在某一期活动中邀请一位及以上好友成功开通快银业务,则在后续各期活动中将累计。</p>
|
||||
<p>2. 由于不可抗力(包括但不限于服务器意外关机、网络意外中断、快银平台受到恶意攻击及磁盘意外损坏)而导致交易数据丢失的情况不计算奖励金额。</p>
|
||||
<p>3. 因业务发展需要,陕西超掌柜科技有限公司有权对奖励金额的计算公式及奖励金额的分润比例进行调整或对影响奖励金额计算的事项进行变动,并将在快银平台以公告形式公布,用户应实时关注快银平台公告内容。</p>
|
||||
<p>1. 该活动为持续性活动,如用户已在某一期活动中邀请一位及以上好友成功开通银收客业务,则在后续各期活动中将累计。</p>
|
||||
<p>2. 由于不可抗力(包括但不限于服务器意外关机、网络意外中断、银收客平台受到恶意攻击及磁盘意外损坏)而导致交易数据丢失的情况不计算奖励金额。</p>
|
||||
<p>3. 因业务发展需要,陕西超掌柜科技有限公司有权对奖励金额的计算公式及奖励金额的分润比例进行调整或对影响奖励金额计算的事项进行变动,并将在银收客平台以公告形式公布,用户应实时关注银收客平台公告内容。</p>
|
||||
<p>五、奖励金额支付</p>
|
||||
<p>1. 自用省钱完成任务,次日自动修改费率。</p>
|
||||
<p>2. 推广赚钱和团队奖励,用户可在账户中直接提现。</p>
|
||||
<p>3. 用户知悉并同意上述结算规则,用户知悉陕西超掌柜科技有限公司有权调整奖励金额的结算日期、支付方式等结算规则及标准并在快银系统上予以公布,若用户继续参与本活动,则视为用户接受新的奖励金额结算规则及标准。新的奖励金额结算规则及标准自公布之日起生效适用。</p>
|
||||
<p>3. 用户知悉并同意上述结算规则,用户知悉陕西超掌柜科技有限公司有权调整奖励金额的结算日期、支付方式等结算规则及标准并在银收客系统上予以公布,若用户继续参与本活动,则视为用户接受新的奖励金额结算规则及标准。新的奖励金额结算规则及标准自公布之日起生效适用。</p>
|
||||
<p>六、其他说明</p>
|
||||
<p>1. 用户承诺具备参与本活动所需的能力。</p>
|
||||
<p>2. 用户参与本活动不构成与快银平台主体公司形成任何目的的合伙、合资、雇佣或代理关系,用户亦不可冒用前述主体名义从事任何活动,否则用户应就其行为承担一切经济及法律责任。</p>
|
||||
<p>3. 用户承诺其推广行为严格遵守法律法规且不侵犯他人合法权益,如实准确地根据快银业务描述进行推荐,否则陕西超掌柜科技有限公司将取消用户参与活动及领取奖励的资格,并由用户应自行承担其行为造成的一切后果及责任。</p>
|
||||
<p>2. 用户参与本活动不构成与银收客平台主体公司形成任何目的的合伙、合资、雇佣或代理关系,用户亦不可冒用前述主体名义从事任何活动,否则用户应就其行为承担一切经济及法律责任。</p>
|
||||
<p>3. 用户承诺其推广行为严格遵守法律法规且不侵犯他人合法权益,如实准确地根据银收客业务描述进行推荐,否则陕西超掌柜科技有限公司将取消用户参与活动及领取奖励的资格,并由用户应自行承担其行为造成的一切后果及责任。</p>
|
||||
<p>4. 如用户存在违规作弊行为(包括但不限于恶意套取资金、机器作弊、虚假申请等违反诚实信用原则行为),陕西超掌柜科技有限公司有权取消其参与活动和领取奖励的资格,必要时追究其法律责任。</p>
|
||||
<p>5. 本活动自规则公告日正式开展,以3个月为周期,逐期开展。如遇不可抗力或特定情况(包括但不限于自然灾害、政府机关指令、网络攻击等),陕西超掌柜科技有限公司有权暂停或取消本活动;活动暂停或取消前发生的交易金额仍按照规则比例计算并结算奖励,活动暂停或取消后发生的交易金额不再计算奖励。但如果活动由于监管等原因被强制暂停,奖励将停止发放。</p>
|
||||
<p>6. 活动期间,活动规则可能发生调整,以快银页面显示的活动规则为准。</p>
|
||||
<p>7. 如遇本活动相关的任何问题,可通过快银“联系客服”选项或拨打客服电话400-675-2070进行咨询或投诉。本活动与Apple Inc.无关。</p>
|
||||
<p>6. 活动期间,活动规则可能发生调整,以银收客页面显示的活动规则为准。</p>
|
||||
<p>7. 如遇本活动相关的任何问题,可通过银收客“联系客服”选项或拨打客服电话400-675-2070进行咨询或投诉。本活动与Apple Inc.无关。</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="toast-wrapper" style="display: none;">
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
<div><span style="color: #FD7564"> >>> </span>1.积分是什么<span style="color: #FD7564"> <<< </span></div>
|
||||
</div>
|
||||
<div class="desc">
|
||||
积分是商户参与快银活动所获得的奖励,可以兑换商品或参与其他活动。
|
||||
积分是商户参与银收客活动所获得的奖励,可以兑换商品或参与其他活动。
|
||||
订单交易所获得的积分,在交易订单满一个月后方可使用,防止违规获取积分(如恶意退款、套现、虚假订单、刷单等)
|
||||
违规商户扣除所有奖励,永久关闭积分活动权限。
|
||||
</div>
|
||||
@@ -131,7 +131,7 @@
|
||||
兑换商品
|
||||
</div>
|
||||
<div style="margin-top: .122rem;line-height: 0.6rem;">
|
||||
积分可以在<span style="color: orangered">"商户活动-积分<兑换商品>"</span>页页面进行商品兑换,兑换商品后,将会扣除等额积分,详细兑换规则可以联系快银客服。
|
||||
积分可以在<span style="color: orangered">"商户活动-积分<兑换商品>"</span>页页面进行商品兑换,兑换商品后,将会扣除等额积分,详细兑换规则可以联系银收客客服。
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<div class="f14">${merchantMenber.memberCode }</div>
|
||||
</div>
|
||||
<div class="weui-flex__item white tright">
|
||||
要收银用快银
|
||||
要收银用银收客
|
||||
</div>
|
||||
</div>
|
||||
<div class="f14 pt20 white">
|
||||
|
||||
Reference in New Issue
Block a user