Browse Source

fix bugs

master
独行之狼 4 years ago
parent
commit
b09215ca23
  1. BIN
      fr-plugin-DataEncryptor-1.0/fr-plugin-DataEncryptor-1.0.jar
  2. BIN
      install/fr-plugin-DataEncryptor-1.0.zip
  3. 4
      src/com/fr/plugin/data/encrypt/FRDEncryptWithMD5AndDES.java
  4. 4
      src/com/fr/plugin/data/encrypt/FRDEncryptWithMD5AndTripleDES.java
  5. 4
      src/com/fr/plugin/data/encrypt/FREncryptWithMD5AndDES.java
  6. 4
      src/com/fr/plugin/data/encrypt/FREncryptWithMD5AndTripleDES.java
  7. 17
      src/com/fr/plugin/data/encrypt/FRGetDataFromHash.java
  8. 6
      src/com/fr/plugin/data/encrypt/FRHashData.java
  9. 13
      src/com/fr/plugin/data/encrypt/FunConstants.java

BIN
fr-plugin-DataEncryptor-1.0/fr-plugin-DataEncryptor-1.0.jar

Binary file not shown.

BIN
install/fr-plugin-DataEncryptor-1.0.zip

Binary file not shown.

4
src/com/fr/plugin/data/encrypt/FRDEncryptWithMD5AndDES.java

@ -13,9 +13,7 @@ public class FRDEncryptWithMD5AndDES extends AbstractFunction {
@Override @Override
@Focus(id = FunConstants.PLUGIN_ID, text = "Plugin-Function_FRDEncryptWithMD5AndDES", source = Original.PLUGIN) @Focus(id = FunConstants.PLUGIN_ID, text = "Plugin-Function_FRDEncryptWithMD5AndDES", source = Original.PLUGIN)
public Object run(Object[] args) { public Object run(Object[] args) {
if (!FunConstants.author()) {
return FunConstants.AUTHOR_ERROR;
}
String checkRes = FunConstants.CheckArgs(args, 2); String checkRes = FunConstants.CheckArgs(args, 2);
if (!checkRes.equals(FunConstants.CHECK_PASS)) { if (!checkRes.equals(FunConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + ":"+checkRes; return Primitive.ERROR_VALUE + ":"+checkRes;

4
src/com/fr/plugin/data/encrypt/FRDEncryptWithMD5AndTripleDES.java

@ -13,9 +13,7 @@ public class FRDEncryptWithMD5AndTripleDES extends AbstractFunction {
@Override @Override
@Focus(id = FunConstants.PLUGIN_ID, text = "Plugin-Function_FRDEncryptWithMD5AndDES", source = Original.PLUGIN) @Focus(id = FunConstants.PLUGIN_ID, text = "Plugin-Function_FRDEncryptWithMD5AndDES", source = Original.PLUGIN)
public Object run(Object[] args) { public Object run(Object[] args) {
if (!FunConstants.author()) {
return FunConstants.AUTHOR_ERROR;
}
String checkRes = FunConstants.CheckArgs(args, 2); String checkRes = FunConstants.CheckArgs(args, 2);
if (!checkRes.equals(FunConstants.CHECK_PASS)) { if (!checkRes.equals(FunConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + ":"+checkRes; return Primitive.ERROR_VALUE + ":"+checkRes;

4
src/com/fr/plugin/data/encrypt/FREncryptWithMD5AndDES.java

@ -13,9 +13,7 @@ public class FREncryptWithMD5AndDES extends AbstractFunction {
@Override @Override
@Focus(id = FunConstants.PLUGIN_ID, text = "Plugin-Function_FREnWithMD5AndDES", source = Original.PLUGIN) @Focus(id = FunConstants.PLUGIN_ID, text = "Plugin-Function_FREnWithMD5AndDES", source = Original.PLUGIN)
public Object run(Object[] args) { public Object run(Object[] args) {
if (!FunConstants.author()) {
return FunConstants.AUTHOR_ERROR;
}
String checkRes = FunConstants.CheckArgs(args, 2); String checkRes = FunConstants.CheckArgs(args, 2);
if (!checkRes.equals(FunConstants.CHECK_PASS)) { if (!checkRes.equals(FunConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + ":"+checkRes; return Primitive.ERROR_VALUE + ":"+checkRes;

4
src/com/fr/plugin/data/encrypt/FREncryptWithMD5AndTripleDES.java

@ -13,9 +13,7 @@ public class FREncryptWithMD5AndTripleDES extends AbstractFunction {
@Override @Override
@Focus(id = FunConstants.PLUGIN_ID, text = "Plugin-Function_FREnWithMD5AndDES", source = Original.PLUGIN) @Focus(id = FunConstants.PLUGIN_ID, text = "Plugin-Function_FREnWithMD5AndDES", source = Original.PLUGIN)
public Object run(Object[] args) { public Object run(Object[] args) {
if (!FunConstants.author()) {
return FunConstants.AUTHOR_ERROR;
}
String checkRes = FunConstants.CheckArgs(args, 2); String checkRes = FunConstants.CheckArgs(args, 2);
if (!checkRes.equals(FunConstants.CHECK_PASS)) { if (!checkRes.equals(FunConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + ":"+checkRes; return Primitive.ERROR_VALUE + ":"+checkRes;

17
src/com/fr/plugin/data/encrypt/FRGetDataFromHash.java

@ -22,9 +22,7 @@ public class FRGetDataFromHash extends AbstractFunction {
@Override @Override
@Focus(id = FunConstants.PLUGIN_ID, text = "Plugin-Function_FRHashData", source = Original.PLUGIN) @Focus(id = FunConstants.PLUGIN_ID, text = "Plugin-Function_FRHashData", source = Original.PLUGIN)
public Object run(Object[] args) throws FormulaException { public Object run(Object[] args) throws FormulaException {
if (!FunConstants.author()) {
return FunConstants.AUTHOR_ERROR;
}
String checkRes = FunConstants.CheckArgs(args, 1); String checkRes = FunConstants.CheckArgs(args, 1);
if (!checkRes.equals(FunConstants.CHECK_PASS)) { if (!checkRes.equals(FunConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + ":"+checkRes; return Primitive.ERROR_VALUE + ":"+checkRes;
@ -37,14 +35,13 @@ public class FRGetDataFromHash extends AbstractFunction {
final private String QueryDataFromID(String hashID){ final private String QueryDataFromID(String hashID){
try { try {
List<EncryptDataEntity> entities = EncryptDataAccessBridge.getDbAccessor().runQueryAction(new DBAction<List<EncryptDataEntity>>() { List<EncryptDataEntity> entities = EncryptDataAccessBridge.getDbAccessor().runQueryAction(daoContext -> {
// 查询
@Override return daoContext.getDAO(EncryptDataDao.class).find(QueryConditionKit.newQueryCondition().addRestriction(RestrictionKit.eq("id", hashID)));
public List<EncryptDataEntity> run(DAOContext daoContext) throws Exception {
// 查询收入大于10000的人
return daoContext.getDAO(EncryptDataDao.class).find(QueryConditionKit.newQueryCondition().addRestriction(RestrictionKit.eq("id", hashID)));
}
}); });
if(entities.size()<=0){
return Primitive.ERROR_VALUE+":数据没有找到!";
}
String result=entities.get(0).getData(); String result=entities.get(0).getData();
final String hashDataMd5 = FunConstants.HashData(result, "md5", false); final String hashDataMd5 = FunConstants.HashData(result, "md5", false);
final String hashDataSha = FunConstants.HashData(result, "sha", false); final String hashDataSha = FunConstants.HashData(result, "sha", false);

6
src/com/fr/plugin/data/encrypt/FRHashData.java

@ -14,9 +14,7 @@ public class FRHashData extends AbstractFunction {
@Override @Override
@Focus(id = FunConstants.PLUGIN_ID, text = "Plugin-Function_FRHashData", source = Original.PLUGIN) @Focus(id = FunConstants.PLUGIN_ID, text = "Plugin-Function_FRHashData", source = Original.PLUGIN)
public Object run(Object[] args) { public Object run(Object[] args) {
if (!FunConstants.author()) {
return FunConstants.AUTHOR_ERROR;
}
String checkRes = FunConstants.CheckArgs(args, 3); String checkRes = FunConstants.CheckArgs(args, 3);
if (!checkRes.equals(FunConstants.CHECK_PASS)) { if (!checkRes.equals(FunConstants.CHECK_PASS)) {
return Primitive.ERROR_VALUE + ":"+checkRes; return Primitive.ERROR_VALUE + ":"+checkRes;
@ -25,7 +23,7 @@ public class FRHashData extends AbstractFunction {
String message= args[0].toString(); String message= args[0].toString();
String type = args[1].toString(); String type = args[1].toString();
boolean isSave = Boolean.parseBoolean(args[2].toString()); boolean isSave = Boolean.parseBoolean(args[2].toString());
FineLoggerFactory.getLogger().info("run :"+isSave); FineLoggerFactory.getLogger().info("message :"+message);
return FunConstants.HashData(message,type,isSave); return FunConstants.HashData(message,type,isSave);
} }

13
src/com/fr/plugin/data/encrypt/FunConstants.java

@ -7,6 +7,7 @@ import com.fr.plugin.data.encrypt.dao.EncryptDataDao;
import com.fr.plugin.data.encrypt.entity.EncryptDataEntity; import com.fr.plugin.data.encrypt.entity.EncryptDataEntity;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Primitive; import com.fr.stable.Primitive;
import com.fr.stable.StringUtils;
import com.fr.stable.db.action.DBAction; import com.fr.stable.db.action.DBAction;
import com.fr.stable.db.dao.DAOContext; import com.fr.stable.db.dao.DAOContext;
import com.fr.stable.fun.Authorize; import com.fr.stable.fun.Authorize;
@ -26,7 +27,7 @@ public class FunConstants {
static final boolean author() { static final boolean author() {
return PluginLicenseManager.getInstance().getPluginLicenseByID(PLUGIN_ID).isAvailable(); return true;
} }
static final String CheckArgs(Object[] args, int num) { static final String CheckArgs(Object[] args, int num) {
@ -60,6 +61,9 @@ public class FunConstants {
} }
static final String HashData(String message,String type,boolean isSave){ static final String HashData(String message,String type,boolean isSave){
if(StringUtils.isEmpty(message)){
return "";
}
BigInteger shaID; BigInteger shaID;
byte[] inputData = message.getBytes(); byte[] inputData = message.getBytes();
try{ try{
@ -93,9 +97,14 @@ public class FunConstants {
} }
final static String EncryptData(String secretKey, String message,String algorithm, boolean isEncrypt){ final static String EncryptData(String secretKey, String message,String algorithm, boolean isEncrypt){
String result;
PooledPBEStringEncryptor pooledPBEStringEncryptor = new PooledPBEStringEncryptor(); PooledPBEStringEncryptor pooledPBEStringEncryptor = new PooledPBEStringEncryptor();
pooledPBEStringEncryptor.setConfig(GetSimpleStringPBEConfig(secretKey,algorithm)); pooledPBEStringEncryptor.setConfig(GetSimpleStringPBEConfig(secretKey,algorithm));
String result = isEncrypt ? pooledPBEStringEncryptor.encrypt(message) : pooledPBEStringEncryptor.decrypt(message); try {
result = isEncrypt ? pooledPBEStringEncryptor.encrypt(message) : pooledPBEStringEncryptor.decrypt(message);
}catch (Exception e){
result = Primitive.ERROR_VALUE + ":解密数据错误";
}
return result; return result;
} }
} }

Loading…
Cancel
Save