<font color=
"#000"
>
import
java.security.InvalidKeyException;
import
java.security.NoSuchAlgorithmException;
import
javax.crypto.BadPaddingException;
import
javax.crypto.Cipher;
import
javax.crypto.IllegalBlockSizeException;
import
javax.crypto.NoSuchPaddingException;
import
javax.crypto.spec.SecretKeySpec;
public
class
AesDecryptString {
public
static
void
main(String[] args) {
String strAesDecryptString = GetAesDecryptString(
"37349EC2F427A1AF812DA757988CB9DE"
,
"AE920882F4F5818501AB6256F91691D5"
);
System.out.println(
"The PhoneNumber is :"
+strAesDecryptString);
}
public
static
String GetAesDecryptString(String content, String key) {
try
{
Cipher Cipher = javax.crypto.Cipher.getInstance(
"AES"
);
Cipher.init(
2
,
new
SecretKeySpec(parseHexStr2Byte(key),
"AES"
));
String strDecrypt =
new
String(Cipher.doFinal(parseHexStr2Byte(
content)));
return
strDecrypt;
}
catch
(BadPaddingException e) {
e.printStackTrace();
}
catch
(IllegalBlockSizeException v1_1) {
v1_1.printStackTrace();
}
catch
(NoSuchPaddingException v1_2) {
v1_2.printStackTrace();
}
catch
(NoSuchAlgorithmException v1_3) {
v1_3.printStackTrace();
}
catch
(InvalidKeyException v1_4) {
v1_4.printStackTrace();
}
return
null
;
}
public
static
byte
[] parseHexStr2Byte(String hexStr) {
byte
[] byteArry;
int
v6 =
16
;
if
(hexStr.length() <
1
) {
byteArry =
null
;
}
else
{
byteArry =
new
byte
[hexStr.length() /
2
];
int
v1;
for
(v1 =
0
; v1 < hexStr.length() /
2
; ++v1) {
byteArry[v1] = ((
byte
)(Integer.parseInt(hexStr.substring(v1 *
2
, v1 *
2
+
1
), v6) *
16
+ Integer.parseInt(hexStr.substring(v1 *
2
+
1
, v1 *
2
+
2
), v6)));
}
}
return
byteArry;
}
}
</font>