51 lines
1.7 KiB
Java
51 lines
1.7 KiB
Java
package o;
|
|
|
|
import android.os.Build;
|
|
import java.security.GeneralSecurityException;
|
|
import java.security.spec.AlgorithmParameterSpec;
|
|
import javax.crypto.Cipher;
|
|
import javax.crypto.SecretKey;
|
|
import javax.crypto.spec.GCMParameterSpec;
|
|
import javax.crypto.spec.IvParameterSpec;
|
|
import javax.crypto.spec.SecretKeySpec;
|
|
import o.uAf;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class Jkv {
|
|
public final boolean b;
|
|
public final SecretKey e;
|
|
private static uAf.RVV d = uAf.RVV.ALGORITHM_REQUIRES_BORINGCRYPTO;
|
|
public static final ThreadLocal<Cipher> c = new ThreadLocal<Cipher>() { // from class: o.Jkv.5
|
|
@Override // java.lang.ThreadLocal
|
|
protected final /* synthetic */ Cipher initialValue() {
|
|
return b();
|
|
}
|
|
|
|
private static Cipher b() {
|
|
try {
|
|
return YYT.a.e("AES/GCM/NoPadding");
|
|
} catch (GeneralSecurityException e) {
|
|
throw new IllegalStateException(e);
|
|
}
|
|
}
|
|
};
|
|
|
|
public Jkv(byte[] bArr) throws GeneralSecurityException {
|
|
if (!d.d()) {
|
|
throw new GeneralSecurityException("Can not use AES-GCM in FIPS-mode, as BoringCrypto module is not available.");
|
|
}
|
|
ifG.e(bArr.length);
|
|
this.e = new SecretKeySpec(bArr, "AES");
|
|
this.b = true;
|
|
}
|
|
|
|
public static AlgorithmParameterSpec e(byte[] bArr) throws GeneralSecurityException {
|
|
Integer valueOf;
|
|
int length = bArr.length;
|
|
if ("The Android Project".equals(System.getProperty("java.vendor")) && ((valueOf = Integer.valueOf(Build.VERSION.SDK_INT)) == null || valueOf.intValue() <= 19)) {
|
|
return new IvParameterSpec(bArr, 0, length);
|
|
}
|
|
return new GCMParameterSpec(128, bArr, 0, length);
|
|
}
|
|
}
|