DES一个或两个key的为空验证问题
This commit is contained in:
@@ -73,15 +73,15 @@ public class DesUtils {
|
|||||||
String encData = "";
|
String encData = "";
|
||||||
List firstKeyBt = null, secondKeyBt = null, thirdKeyBt = null;
|
List firstKeyBt = null, secondKeyBt = null, thirdKeyBt = null;
|
||||||
int firstLength = 0, secondLength = 0, thirdLength = 0;
|
int firstLength = 0, secondLength = 0, thirdLength = 0;
|
||||||
if (firstKey != null && firstKey != "") {
|
if (firstKey != null && firstKey.equals("")) {
|
||||||
firstKeyBt = getKeyBytes(firstKey);
|
firstKeyBt = getKeyBytes(firstKey);
|
||||||
firstLength = firstKeyBt.size();
|
firstLength = firstKeyBt.size();
|
||||||
}
|
}
|
||||||
if (secondKey != null && secondKey != "") {
|
if (secondKey != null && secondKey.equals("")) {
|
||||||
secondKeyBt = getKeyBytes(secondKey);
|
secondKeyBt = getKeyBytes(secondKey);
|
||||||
secondLength = secondKeyBt.size();
|
secondLength = secondKeyBt.size();
|
||||||
}
|
}
|
||||||
if (thirdKey != null && thirdKey != "") {
|
if (thirdKey != null && thirdKey.equals("")) {
|
||||||
thirdKeyBt = getKeyBytes(thirdKey);
|
thirdKeyBt = getKeyBytes(thirdKey);
|
||||||
thirdLength = thirdKeyBt.size();
|
thirdLength = thirdKeyBt.size();
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ public class DesUtils {
|
|||||||
if (leng < 4) {
|
if (leng < 4) {
|
||||||
int[] bt = strToBt(data);
|
int[] bt = strToBt(data);
|
||||||
int[] encByte = null;
|
int[] encByte = null;
|
||||||
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "" && thirdKey != null && thirdKey != "") {
|
if (firstKey != null && firstKey.equals("") && secondKey != null && secondKey.equals("") && thirdKey != null && thirdKey.equals("")) {
|
||||||
int[] tempBt;
|
int[] tempBt;
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
tempBt = bt;
|
tempBt = bt;
|
||||||
@@ -105,7 +105,7 @@ public class DesUtils {
|
|||||||
}
|
}
|
||||||
encByte = tempBt;
|
encByte = tempBt;
|
||||||
} else {
|
} else {
|
||||||
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") {
|
if (firstKey != null && firstKey.equals("") && secondKey != null && secondKey.equals("")) {
|
||||||
int[] tempBt;
|
int[] tempBt;
|
||||||
int x, y;
|
int x, y;
|
||||||
tempBt = bt;
|
tempBt = bt;
|
||||||
@@ -117,7 +117,7 @@ public class DesUtils {
|
|||||||
}
|
}
|
||||||
encByte = tempBt;
|
encByte = tempBt;
|
||||||
} else {
|
} else {
|
||||||
if (firstKey != null && firstKey != "") {
|
if (firstKey != null && firstKey.equals("")) {
|
||||||
int[] tempBt;
|
int[] tempBt;
|
||||||
int x = 0;
|
int x = 0;
|
||||||
tempBt = bt;
|
tempBt = bt;
|
||||||
@@ -137,7 +137,7 @@ public class DesUtils {
|
|||||||
String tempData = data.substring(i * 4 + 0, i * 4 + 4);
|
String tempData = data.substring(i * 4 + 0, i * 4 + 4);
|
||||||
int[] tempByte = strToBt(tempData);
|
int[] tempByte = strToBt(tempData);
|
||||||
int[] encByte = null;
|
int[] encByte = null;
|
||||||
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "" && thirdKey != null && thirdKey != "") {
|
if (firstKey != null && firstKey.equals("") && secondKey != null && secondKey.equals("") && thirdKey != null && thirdKey.equals("")) {
|
||||||
int[] tempBt;
|
int[] tempBt;
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
tempBt = tempByte;
|
tempBt = tempByte;
|
||||||
@@ -152,7 +152,7 @@ public class DesUtils {
|
|||||||
}
|
}
|
||||||
encByte = tempBt;
|
encByte = tempBt;
|
||||||
} else {
|
} else {
|
||||||
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") {
|
if (firstKey != null && firstKey.equals("") && secondKey != null && secondKey.equals("")) {
|
||||||
int[] tempBt;
|
int[] tempBt;
|
||||||
int x, y;
|
int x, y;
|
||||||
tempBt = tempByte;
|
tempBt = tempByte;
|
||||||
@@ -164,7 +164,7 @@ public class DesUtils {
|
|||||||
}
|
}
|
||||||
encByte = tempBt;
|
encByte = tempBt;
|
||||||
} else {
|
} else {
|
||||||
if (firstKey != null && firstKey != "") {
|
if (firstKey != null && firstKey.equals("")) {
|
||||||
int[] tempBt;
|
int[] tempBt;
|
||||||
int x;
|
int x;
|
||||||
tempBt = tempByte;
|
tempBt = tempByte;
|
||||||
@@ -181,7 +181,7 @@ public class DesUtils {
|
|||||||
String remainderData = data.substring(iterator * 4 + 0, leng);
|
String remainderData = data.substring(iterator * 4 + 0, leng);
|
||||||
int[] tempByte = strToBt(remainderData);
|
int[] tempByte = strToBt(remainderData);
|
||||||
int[] encByte = null;
|
int[] encByte = null;
|
||||||
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "" && thirdKey != null && thirdKey != "") {
|
if (firstKey != null && firstKey.equals("") && secondKey != null && secondKey.equals("") && thirdKey != null && thirdKey.equals("")) {
|
||||||
int[] tempBt;
|
int[] tempBt;
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
tempBt = tempByte;
|
tempBt = tempByte;
|
||||||
@@ -196,7 +196,7 @@ public class DesUtils {
|
|||||||
}
|
}
|
||||||
encByte = tempBt;
|
encByte = tempBt;
|
||||||
} else {
|
} else {
|
||||||
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") {
|
if (firstKey != null && firstKey.equals("") && secondKey != null && secondKey.equals("")) {
|
||||||
int[] tempBt;
|
int[] tempBt;
|
||||||
int x, y;
|
int x, y;
|
||||||
tempBt = tempByte;
|
tempBt = tempByte;
|
||||||
@@ -208,7 +208,7 @@ public class DesUtils {
|
|||||||
}
|
}
|
||||||
encByte = tempBt;
|
encByte = tempBt;
|
||||||
} else {
|
} else {
|
||||||
if (firstKey != null && firstKey != "") {
|
if (firstKey != null && firstKey.equals("")) {
|
||||||
int[] tempBt;
|
int[] tempBt;
|
||||||
int x;
|
int x;
|
||||||
tempBt = tempByte;
|
tempBt = tempByte;
|
||||||
@@ -236,15 +236,15 @@ public class DesUtils {
|
|||||||
String decStr = "";
|
String decStr = "";
|
||||||
List firstKeyBt = null, secondKeyBt = null, thirdKeyBt = null;
|
List firstKeyBt = null, secondKeyBt = null, thirdKeyBt = null;
|
||||||
int firstLength = 0, secondLength = 0, thirdLength = 0;
|
int firstLength = 0, secondLength = 0, thirdLength = 0;
|
||||||
if (firstKey != null && firstKey != "") {
|
if (firstKey != null && firstKey.equals("")) {
|
||||||
firstKeyBt = getKeyBytes(firstKey);
|
firstKeyBt = getKeyBytes(firstKey);
|
||||||
firstLength = firstKeyBt.size();
|
firstLength = firstKeyBt.size();
|
||||||
}
|
}
|
||||||
if (secondKey != null && secondKey != "") {
|
if (secondKey != null && secondKey.equals("")) {
|
||||||
secondKeyBt = getKeyBytes(secondKey);
|
secondKeyBt = getKeyBytes(secondKey);
|
||||||
secondLength = secondKeyBt.size();
|
secondLength = secondKeyBt.size();
|
||||||
}
|
}
|
||||||
if (thirdKey != null && thirdKey != "") {
|
if (thirdKey != null && thirdKey.equals("")) {
|
||||||
thirdKeyBt = getKeyBytes(thirdKey);
|
thirdKeyBt = getKeyBytes(thirdKey);
|
||||||
thirdLength = thirdKeyBt.size();
|
thirdLength = thirdKeyBt.size();
|
||||||
}
|
}
|
||||||
@@ -260,7 +260,7 @@ public class DesUtils {
|
|||||||
intByte[j] = Integer.parseInt(strByte.substring(j, j + 1));
|
intByte[j] = Integer.parseInt(strByte.substring(j, j + 1));
|
||||||
}
|
}
|
||||||
int[] decByte = null;
|
int[] decByte = null;
|
||||||
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "" && thirdKey != null && thirdKey != "") {
|
if (firstKey != null && firstKey.equals("") && secondKey != null && secondKey.equals("") && thirdKey != null && thirdKey.equals("")) {
|
||||||
int[] tempBt;
|
int[] tempBt;
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
tempBt = intByte;
|
tempBt = intByte;
|
||||||
@@ -275,7 +275,7 @@ public class DesUtils {
|
|||||||
}
|
}
|
||||||
decByte = tempBt;
|
decByte = tempBt;
|
||||||
} else {
|
} else {
|
||||||
if (firstKey != null && firstKey != "" && secondKey != null && secondKey != "") {
|
if (firstKey != null && firstKey.equals("") && secondKey != null && secondKey.equals("")) {
|
||||||
int[] tempBt;
|
int[] tempBt;
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
tempBt = intByte;
|
tempBt = intByte;
|
||||||
@@ -287,7 +287,7 @@ public class DesUtils {
|
|||||||
}
|
}
|
||||||
decByte = tempBt;
|
decByte = tempBt;
|
||||||
} else {
|
} else {
|
||||||
if (firstKey != null && firstKey != "") {
|
if (firstKey != null && firstKey.equals("")) {
|
||||||
int[] tempBt;
|
int[] tempBt;
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
tempBt = intByte;
|
tempBt = intByte;
|
||||||
|
|||||||
Reference in New Issue
Block a user