[Modify]修改项目配置和将加密模式修改为So库
This commit is contained in:
BIN
app/libs/arm64-v8a/libpeko-common.so
Normal file
BIN
app/libs/arm64-v8a/libpeko-common.so
Normal file
Binary file not shown.
BIN
app/libs/armeabi-v7a/libpeko-common.so
Normal file
BIN
app/libs/armeabi-v7a/libpeko-common.so
Normal file
Binary file not shown.
@@ -1006,11 +1006,8 @@
|
||||
<receiver
|
||||
android:name="com.netease.nimlib.service.NimReceiver"
|
||||
android:exported="false"
|
||||
android:process=":core">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
||||
</intent-filter>
|
||||
android:process=":core"
|
||||
tools:node="remove">
|
||||
</receiver>
|
||||
<receiver android:name="com.netease.nimlib.service.ResponseReceiver" />
|
||||
<receiver
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<network-security-config>
|
||||
|
||||
<base-config cleartextTrafficPermitted="false">
|
||||
<base-config cleartextTrafficPermitted="true">
|
||||
<debug-overrides>
|
||||
<trust-anchors>
|
||||
<certificates src="system" />
|
||||
|
@@ -24,16 +24,16 @@ public class APIEncryptUtil {
|
||||
private static final String DES_ENCRYPT_KEY_SMS_SIGN = XChatConstants.DES_ENCRYPT_KEY_SMS_SIGN;
|
||||
|
||||
|
||||
/**
|
||||
* 参数加密
|
||||
* @param params
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String encryptParams(Map<String,String> params) throws Exception{
|
||||
String json = new Gson().toJson(params);
|
||||
return DESUtils.DESAndBase64Encrypt(json,DES_ENCRYPT_KEY_SMS_PARAMS);
|
||||
}
|
||||
// /**
|
||||
// * 参数加密
|
||||
// * @param params
|
||||
// * @return
|
||||
// * @throws Exception
|
||||
// */
|
||||
// public static String encryptParams(Map<String,String> params) throws Exception{
|
||||
// String json = new Gson().toJson(params);
|
||||
// return DESUtils.DESAndBase64Encrypt(json,DES_ENCRYPT_KEY_SMS_PARAMS);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 生成签名
|
||||
|
@@ -118,7 +118,7 @@ public class WithdrawModel extends BaseModel implements IWithdrawModel {
|
||||
String paramsStr = null;
|
||||
String signStr = null;
|
||||
try {
|
||||
paramsStr = APIEncryptUtil.encryptParams(paramsEncrypt);
|
||||
// paramsStr = APIEncryptUtil.encryptParams(paramsEncrypt);
|
||||
signStr = APIEncryptUtil.paramsToSign(paramsEncrypt);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@@ -1,95 +1,19 @@
|
||||
package com.yizhuan.xchat_android_library.utils.codec;
|
||||
|
||||
import android.util.Base64;
|
||||
|
||||
import com.yizhuan.xchat_android_library.utils.StringUtils;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.security.Key;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.DESKeySpec;
|
||||
|
||||
public class DESUtils {
|
||||
|
||||
static String DES = "DES";
|
||||
static String ENCODE = "UTF-8";//保持平台兼容统一使用utf-8
|
||||
|
||||
//des 加密
|
||||
private static byte[] encryptByteDES(byte[] byteD, String strKey) throws Exception {
|
||||
return doEncrypt(byteD, getKey(strKey), DES);
|
||||
static {
|
||||
System.loadLibrary("peko-common");
|
||||
}
|
||||
|
||||
//des 解密
|
||||
private static byte[] decryptByteDES(byte[] byteD, String strKey) throws Exception {
|
||||
return doDecrypt(byteD, getKey(strKey), DES);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行加密操作
|
||||
*
|
||||
* @param data 待操作数据
|
||||
* @param key Key
|
||||
* @param type 算法 RSA or DES
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private static byte[] doEncrypt(byte[] data, Key key, String type) throws Exception {
|
||||
Cipher cipher = Cipher.getInstance(type);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, key);
|
||||
return cipher.doFinal(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行解密操作
|
||||
*
|
||||
* @param data 待操作数据
|
||||
* @param key Key
|
||||
* @param type 算法 RSA or DES
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private static byte[] doDecrypt(byte[] data, Key key, String type) throws Exception {
|
||||
Cipher cipher = Cipher.getInstance(type);
|
||||
cipher.init(Cipher.DECRYPT_MODE, key);
|
||||
return cipher.doFinal(data);
|
||||
}
|
||||
|
||||
public static SecretKey getKey(String strKey) throws Exception {
|
||||
DESKeySpec desKeySpec = new DESKeySpec(strKey.getBytes());
|
||||
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
|
||||
SecretKey sk = keyFactory.generateSecret(desKeySpec);
|
||||
return sk;
|
||||
}
|
||||
|
||||
//客户端加密
|
||||
public static String DESAndBase64Encrypt(String dataToEncrypt, String secretKey) throws Exception {
|
||||
byte[] encryptData = encryptByteDES(dataToEncrypt.getBytes(ENCODE), secretKey);//这里加密前不要处理加密数据的空格换行等事情
|
||||
byte[] encode = Base64.encode(encryptData, Base64.DEFAULT);
|
||||
String dataBase64 = StringUtils.toEncodedString(encode, Charset.defaultCharset());
|
||||
return replaceBlank(dataBase64);
|
||||
}
|
||||
|
||||
//客户端加密
|
||||
public static String DESAndBase64Encrypt(String dataToEncypt) throws Exception {
|
||||
byte[] encryptData = encryptByteDES(replaceBlank(dataToEncypt).getBytes(ENCODE), "1ea53d260ecf11e7b56e00163e046a26");
|
||||
byte[] encode = Base64.encode(encryptData, Base64.DEFAULT);
|
||||
String dataBase64 = StringUtils.toEncodedString(encode, Charset.defaultCharset());
|
||||
return replaceBlank(dataBase64);
|
||||
}
|
||||
|
||||
public static String replaceBlank(String str) {
|
||||
String dest = "";
|
||||
if (str != null) {
|
||||
Pattern p = Pattern.compile("\\s*|\t|\r|\n");
|
||||
Matcher m = p.matcher(str);
|
||||
dest = m.replaceAll("");
|
||||
}
|
||||
return dest;
|
||||
public static String DESAndBase64Encrypt(String dataToEncrypt) {
|
||||
return replaceBlank(stringFromJNI(replaceBlank(dataToEncrypt)));
|
||||
}
|
||||
|
||||
public static String DESAndBase64(String psw) {
|
||||
@@ -102,13 +26,23 @@ public class DESUtils {
|
||||
return pwd;
|
||||
}
|
||||
|
||||
//服务端解密
|
||||
public static String DESAndBase64Decrypt(String dataBase64) throws Exception {
|
||||
if (StringUtils.isEmpty(dataBase64)) return null;
|
||||
byte[] encryptedData = Base64.decode(dataBase64, Base64.DEFAULT);
|
||||
byte[] decryptedData = decryptByteDES(encryptedData, "1ea53d260ecf11e7b56e00163e046a26");
|
||||
String textDecrypt = new String(decryptedData, ENCODE);
|
||||
return textDecrypt;
|
||||
public static String replaceBlank(String str) {
|
||||
String dest = "";
|
||||
if (str != null) {
|
||||
Pattern p = Pattern.compile("\\s*|\t|\r|\n");
|
||||
Matcher m = p.matcher(str);
|
||||
dest = m.replaceAll("");
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
public static String DESAndBase64Decrypt(String dataBase64) {
|
||||
if (StringUtils.isEmpty(dataBase64)) return null;
|
||||
return stringFromJNI2(dataBase64);
|
||||
}
|
||||
|
||||
public static native String stringFromJNI(String str);
|
||||
|
||||
public static native String stringFromJNI2(String str);
|
||||
|
||||
}
|
@@ -21,7 +21,7 @@ MobSDK {
|
||||
}
|
||||
|
||||
GooglePlus {
|
||||
appId "797840604753-tkallb8sk9seonnpartgd3kjhuem27m4.apps.googleusercontent.com"
|
||||
appId "601499500560-s4on3am564vt2dhd1q4jb3hr11n2nr8j.apps.googleusercontent.com"
|
||||
callbackUri "http://localhost"
|
||||
officialVersion "default"
|
||||
enable true
|
||||
|
@@ -10,7 +10,7 @@
|
||||
<Twitter Enable="false" />
|
||||
<Evernote Enable="false" />
|
||||
<FourSquare Enable="false" />
|
||||
<GooglePlus OfficialVersion="default" Enable="true" ClientID="797840604753-tkallb8sk9seonnpartgd3kjhuem27m4.apps.googleusercontent.com" RedirectUrl="http://localhost" />
|
||||
<GooglePlus OfficialVersion="default" Enable="true" ClientID="601499500560-s4on3am564vt2dhd1q4jb3hr11n2nr8j.apps.googleusercontent.com" RedirectUrl="http://localhost" />
|
||||
<Instagram Enable="false" />
|
||||
<LinkedIn Enable="false" />
|
||||
<Tumblr Enable="false" />
|
||||
|
Reference in New Issue
Block a user