108 lines
3.4 KiB
Java
108 lines
3.4 KiB
Java
|
package o;
|
||
|
|
||
|
import java.security.InvalidAlgorithmParameterException;
|
||
|
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.IvParameterSpec;
|
||
|
import javax.crypto.spec.SecretKeySpec;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class JyG {
|
||
|
public static byte[] a(byte[] bArr, byte[] bArr2, byte[] bArr3) {
|
||
|
if (bArr == null) {
|
||
|
return new byte[0];
|
||
|
}
|
||
|
if (bArr.length == 0) {
|
||
|
return new byte[0];
|
||
|
}
|
||
|
if (bArr2 == null) {
|
||
|
return new byte[0];
|
||
|
}
|
||
|
if (bArr2.length < 16) {
|
||
|
return new byte[0];
|
||
|
}
|
||
|
if (bArr3.length < 16) {
|
||
|
return new byte[0];
|
||
|
}
|
||
|
SecretKeySpec secretKeySpec = new SecretKeySpec(bArr2, "AES");
|
||
|
try {
|
||
|
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||
|
cipher.init(1, secretKeySpec, new IvParameterSpec(bArr3));
|
||
|
return cipher.doFinal(bArr);
|
||
|
} catch (NullPointerException e) {
|
||
|
e.getMessage();
|
||
|
return new byte[0];
|
||
|
} catch (InvalidAlgorithmParameterException e2) {
|
||
|
e2.getMessage();
|
||
|
return new byte[0];
|
||
|
} catch (InvalidKeyException e3) {
|
||
|
e3.getMessage();
|
||
|
return new byte[0];
|
||
|
} catch (NoSuchAlgorithmException e4) {
|
||
|
e4.getMessage();
|
||
|
return new byte[0];
|
||
|
} catch (BadPaddingException e5) {
|
||
|
e5.getMessage();
|
||
|
return new byte[0];
|
||
|
} catch (IllegalBlockSizeException e6) {
|
||
|
e6.getMessage();
|
||
|
return new byte[0];
|
||
|
} catch (NoSuchPaddingException e7) {
|
||
|
e7.getMessage();
|
||
|
return new byte[0];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static byte[] b(byte[] bArr, byte[] bArr2, byte[] bArr3) {
|
||
|
if (bArr == null) {
|
||
|
return new byte[0];
|
||
|
}
|
||
|
if (bArr.length == 0) {
|
||
|
return new byte[0];
|
||
|
}
|
||
|
if (bArr2 == null) {
|
||
|
return new byte[0];
|
||
|
}
|
||
|
if (bArr2.length < 16) {
|
||
|
return new byte[0];
|
||
|
}
|
||
|
if (bArr3 == null) {
|
||
|
return new byte[0];
|
||
|
}
|
||
|
if (bArr3.length < 16) {
|
||
|
return new byte[0];
|
||
|
}
|
||
|
SecretKeySpec secretKeySpec = new SecretKeySpec(bArr2, "AES");
|
||
|
try {
|
||
|
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||
|
cipher.init(2, secretKeySpec, new IvParameterSpec(bArr3));
|
||
|
return cipher.doFinal(bArr);
|
||
|
} catch (NullPointerException e) {
|
||
|
e.getMessage();
|
||
|
return new byte[0];
|
||
|
} catch (InvalidAlgorithmParameterException e2) {
|
||
|
e2.getMessage();
|
||
|
return new byte[0];
|
||
|
} catch (InvalidKeyException e3) {
|
||
|
e3.getMessage();
|
||
|
return new byte[0];
|
||
|
} catch (NoSuchAlgorithmException e4) {
|
||
|
e4.getMessage();
|
||
|
return new byte[0];
|
||
|
} catch (BadPaddingException e5) {
|
||
|
e5.getMessage();
|
||
|
return new byte[0];
|
||
|
} catch (IllegalBlockSizeException e6) {
|
||
|
e6.getMessage();
|
||
|
return new byte[0];
|
||
|
} catch (NoSuchPaddingException e7) {
|
||
|
e7.getMessage();
|
||
|
return new byte[0];
|
||
|
}
|
||
|
}
|
||
|
}
|