40 lines
1.1 KiB
Java
40 lines
1.1 KiB
Java
|
package o;
|
||
|
|
||
|
import java.security.GeneralSecurityException;
|
||
|
import javax.crypto.Cipher;
|
||
|
import javax.crypto.spec.GCMParameterSpec;
|
||
|
import javax.crypto.spec.SecretKeySpec;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class YkQ {
|
||
|
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.length < 12) {
|
||
|
return new byte[0];
|
||
|
}
|
||
|
try {
|
||
|
SecretKeySpec secretKeySpec = new SecretKeySpec(bArr2, "AES");
|
||
|
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
|
||
|
cipher.init(1, secretKeySpec, new GCMParameterSpec(128, bArr3));
|
||
|
return cipher.doFinal(bArr);
|
||
|
} catch (NullPointerException e) {
|
||
|
e.getMessage();
|
||
|
return new byte[0];
|
||
|
} catch (GeneralSecurityException e2) {
|
||
|
e2.getMessage();
|
||
|
return new byte[0];
|
||
|
}
|
||
|
}
|
||
|
}
|