79 lines
2.4 KiB
Java
79 lines
2.4 KiB
Java
package o;
|
|
|
|
import com.google.android.gms.security.ProviderInstaller;
|
|
import java.security.GeneralSecurityException;
|
|
import java.security.Provider;
|
|
import java.security.Security;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.logging.Logger;
|
|
import javax.crypto.Cipher;
|
|
import javax.crypto.Mac;
|
|
import o.iBZ;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class YYT<T_WRAPPER extends iBZ<T_ENGINE>, T_ENGINE> {
|
|
public static final YYT<iBZ.LWm, Cipher> a;
|
|
public static final YYT<iBZ.IeS, Mac> b;
|
|
private static final boolean c;
|
|
private static final Logger d = Logger.getLogger(YYT.class.getName());
|
|
private static final List<Provider> e;
|
|
private final T_WRAPPER i;
|
|
|
|
static {
|
|
if (uAf.c()) {
|
|
e = a(ProviderInstaller.PROVIDER_NAME, "AndroidOpenSSL", "Conscrypt");
|
|
c = false;
|
|
} else if ("The Android Project".equals(System.getProperty("java.vendor"))) {
|
|
e = a(ProviderInstaller.PROVIDER_NAME, "AndroidOpenSSL");
|
|
c = true;
|
|
} else {
|
|
e = new ArrayList();
|
|
c = true;
|
|
}
|
|
a = new YYT<>(new iBZ.LWm());
|
|
b = new YYT<>(new iBZ.IeS());
|
|
new YYT(new iBZ.ojQ());
|
|
new YYT(new iBZ.jbe());
|
|
new YYT(new iBZ.Sts());
|
|
new YYT(new iBZ.RVV());
|
|
new YYT(new iBZ.HBt());
|
|
}
|
|
|
|
private static List<Provider> a(String... strArr) {
|
|
ArrayList arrayList = new ArrayList();
|
|
for (String str : strArr) {
|
|
Provider provider = Security.getProvider(str);
|
|
if (provider != null) {
|
|
arrayList.add(provider);
|
|
} else {
|
|
d.info(String.format("Provider %s not available", str));
|
|
}
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
private YYT(T_WRAPPER t_wrapper) {
|
|
this.i = t_wrapper;
|
|
}
|
|
|
|
public final T_ENGINE e(String str) throws GeneralSecurityException {
|
|
Iterator<Provider> it = e.iterator();
|
|
Exception exc = null;
|
|
while (it.hasNext()) {
|
|
try {
|
|
return (T_ENGINE) this.i.a(str, it.next());
|
|
} catch (Exception e2) {
|
|
if (exc == null) {
|
|
exc = e2;
|
|
}
|
|
}
|
|
}
|
|
if (c) {
|
|
return (T_ENGINE) this.i.a(str, null);
|
|
}
|
|
throw new GeneralSecurityException("No good Provider found.", exc);
|
|
}
|
|
}
|