94 lines
3.0 KiB
Java
94 lines
3.0 KiB
Java
|
package o;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.os.Build;
|
||
|
import android.security.keystore.KeyGenParameterSpec;
|
||
|
import com.airbnb.deeplinkdispatch.UrlTreeKt;
|
||
|
import com.google.android.gms.stats.CodePackage;
|
||
|
import java.io.IOException;
|
||
|
import java.security.GeneralSecurityException;
|
||
|
import java.security.KeyStore;
|
||
|
import java.security.KeyStoreException;
|
||
|
import java.security.NoSuchAlgorithmException;
|
||
|
import java.security.cert.CertificateException;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class sQp {
|
||
|
private final KeyGenParameterSpec c;
|
||
|
public final String e;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public enum LWm {
|
||
|
AES256_GCM
|
||
|
}
|
||
|
|
||
|
sQp(String str, Object obj) {
|
||
|
this.e = str;
|
||
|
this.c = (KeyGenParameterSpec) obj;
|
||
|
}
|
||
|
|
||
|
private boolean a() {
|
||
|
try {
|
||
|
KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
|
||
|
keyStore.load(null);
|
||
|
return keyStore.containsAlias(this.e);
|
||
|
} catch (IOException | KeyStoreException | NoSuchAlgorithmException | CertificateException unused) {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final String toString() {
|
||
|
StringBuilder sb = new StringBuilder("MasterKey{keyAlias=");
|
||
|
sb.append(this.e);
|
||
|
sb.append(", isKeyStoreBacked=");
|
||
|
sb.append(a());
|
||
|
sb.append(UrlTreeKt.componentParamSuffix);
|
||
|
return sb.toString();
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public static final class IeS {
|
||
|
public LWm a;
|
||
|
boolean b;
|
||
|
public final String c;
|
||
|
public KeyGenParameterSpec d;
|
||
|
final Context e;
|
||
|
boolean f;
|
||
|
|
||
|
public IeS(Context context) {
|
||
|
this(context, "_androidx_security_master_key_");
|
||
|
}
|
||
|
|
||
|
private IeS(Context context, String str) {
|
||
|
this.e = context.getApplicationContext();
|
||
|
this.c = str;
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public static class HBt {
|
||
|
public static String AN_(KeyGenParameterSpec keyGenParameterSpec) {
|
||
|
return keyGenParameterSpec.getKeystoreAlias();
|
||
|
}
|
||
|
|
||
|
public static sQp d(IeS ieS) throws GeneralSecurityException, IOException {
|
||
|
LWm lWm = ieS.a;
|
||
|
if (ieS.d == null) {
|
||
|
throw new IllegalArgumentException("build() called before setKeyGenParameterSpec or setKeyScheme.");
|
||
|
}
|
||
|
if (ieS.a == LWm.AES256_GCM) {
|
||
|
KeyGenParameterSpec.Builder keySize = new KeyGenParameterSpec.Builder(ieS.c, 3).setBlockModes(CodePackage.GCM).setEncryptionPaddings("NoPadding").setKeySize(256);
|
||
|
boolean z = ieS.b;
|
||
|
if (Build.VERSION.SDK_INT >= 28) {
|
||
|
boolean z2 = ieS.f;
|
||
|
}
|
||
|
ieS.d = keySize.build();
|
||
|
}
|
||
|
if (ieS.d == null) {
|
||
|
throw new NullPointerException("KeyGenParameterSpec was null after build() check");
|
||
|
}
|
||
|
return new sQp(XFe.AO_(ieS.d), ieS.d);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|