AES逆向求帮助
答案:2 悬赏:10 手机版
解决时间 2021-02-23 17:35
- 提问者网友:蓝莓格格巫
- 2021-02-23 00:11
AES逆向求帮助
最佳答案
- 五星知识达人网友:你可爱的野爹
- 2021-02-23 01:47
AES加密类源码
package com.szzc.volley.utils;
import java.security.Security;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
public class CryptAESNew
{
private static final String key = "shenzhoucar123123";
private Cipher dCipher;
private Cipher eCipher;
private byte[] iv = { 10, 1, 11, 5, 4, 15, 7, 9, 23, 3, 1, 6, 8, 12, 13, 91 };
private SecretKeySpec sKey;
static
{
Security.addProvider(new BouncyCastleProvider());
}
public CryptAESNew()
{
byte[] arrayOfByte1 = new byte[16];
try
{
byte[] arrayOfByte2 = "shenzhoucar123123".getBytes("UTF-8");
for (int i = 0; ; i++)
{
if (i >= "shenzhoucar123123".length());
do
{
IvParameterSpec localIvParameterSpec = new IvParameterSpec(this.iv);
this.sKey = new SecretKeySpec(arrayOfByte1, "AES");
this.eCipher = Cipher.getInstance("AES/CBC/PKCS7Padding");
this.eCipher.init(1, this.sKey, localIvParameterSpec);
this.dCipher = Cipher.getInstance("AES/CBC/PKCS7Padding");
this.dCipher.init(2, this.sKey, localIvParameterSpec);
return;
}
while (i >= arrayOfByte1.length);
arrayOfByte1[i] = arrayOfByte2[i];
}
}
catch (Exception localException)
{
localException.printStackTrace();
}
}
private byte[] decrypt(byte[] paramArrayOfByte)
throws IllegalBlockSizeException, BadPaddingException
{
return this.dCipher.doFinal(paramArrayOfByte);
}
private byte[] encrypt(byte[] paramArrayOfByte)
throws IllegalBlockSizeException, BadPaddingException
{
return this.eCipher.doFinal(paramArrayOfByte);
}
public String onDecrypt(String paramString)
{
try
{
String str = new String(decrypt(Base64Decoder.decodeToBytes(paramString)));
return str;
}
catch (Exception localException)
{
localException.printStackTrace();
}
return "";
}
public String onEncrypt(String paramString)
{
try
{
String str = Base64Encoder.encode(encrypt(paramString.getBytes("UTF-8")));
return str;
}
catch (Exception localException)
{
localException.printStackTrace();
}
return "";
}
}
package com.szzc.volley.utils;
import java.security.Security;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
public class CryptAESNew
{
private static final String key = "shenzhoucar123123";
private Cipher dCipher;
private Cipher eCipher;
private byte[] iv = { 10, 1, 11, 5, 4, 15, 7, 9, 23, 3, 1, 6, 8, 12, 13, 91 };
private SecretKeySpec sKey;
static
{
Security.addProvider(new BouncyCastleProvider());
}
public CryptAESNew()
{
byte[] arrayOfByte1 = new byte[16];
try
{
byte[] arrayOfByte2 = "shenzhoucar123123".getBytes("UTF-8");
for (int i = 0; ; i++)
{
if (i >= "shenzhoucar123123".length());
do
{
IvParameterSpec localIvParameterSpec = new IvParameterSpec(this.iv);
this.sKey = new SecretKeySpec(arrayOfByte1, "AES");
this.eCipher = Cipher.getInstance("AES/CBC/PKCS7Padding");
this.eCipher.init(1, this.sKey, localIvParameterSpec);
this.dCipher = Cipher.getInstance("AES/CBC/PKCS7Padding");
this.dCipher.init(2, this.sKey, localIvParameterSpec);
return;
}
while (i >= arrayOfByte1.length);
arrayOfByte1[i] = arrayOfByte2[i];
}
}
catch (Exception localException)
{
localException.printStackTrace();
}
}
private byte[] decrypt(byte[] paramArrayOfByte)
throws IllegalBlockSizeException, BadPaddingException
{
return this.dCipher.doFinal(paramArrayOfByte);
}
private byte[] encrypt(byte[] paramArrayOfByte)
throws IllegalBlockSizeException, BadPaddingException
{
return this.eCipher.doFinal(paramArrayOfByte);
}
public String onDecrypt(String paramString)
{
try
{
String str = new String(decrypt(Base64Decoder.decodeToBytes(paramString)));
return str;
}
catch (Exception localException)
{
localException.printStackTrace();
}
return "";
}
public String onEncrypt(String paramString)
{
try
{
String str = Base64Encoder.encode(encrypt(paramString.getBytes("UTF-8")));
return str;
}
catch (Exception localException)
{
localException.printStackTrace();
}
return "";
}
}
全部回答
- 1楼网友:不如潦草
- 2021-02-23 03:03
你说呢...
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯