what-the-bank/sources/o/C15430gqM.java

91 lines
4.1 KiB
Java

package o;
import java.io.IOException;
import java.security.AlgorithmParameters;
import java.security.GeneralSecurityException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.Provider;
import java.security.Security;
import java.security.Signature;
import java.security.SignatureException;
import java.security.spec.PSSParameterSpec;
/* renamed from: o.gqM, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
final class C15430gqM {
private static final AbstractC15347gnw d = C15380got.a;
C15430gqM() {
}
/* JADX INFO: Access modifiers changed from: package-private */
public static void d(Signature signature, InterfaceC15342gnr interfaceC15342gnr) throws NoSuchAlgorithmException, SignatureException, InvalidKeyException {
if (interfaceC15342gnr == null || d.equals(interfaceC15342gnr)) {
return;
}
AlgorithmParameters algorithmParameters = AlgorithmParameters.getInstance(signature.getAlgorithm(), signature.getProvider());
try {
algorithmParameters.init(interfaceC15342gnr.i().l());
if (signature.getAlgorithm().endsWith("MGF1")) {
try {
signature.setParameter(algorithmParameters.getParameterSpec(PSSParameterSpec.class));
} catch (GeneralSecurityException e) {
StringBuilder sb = new StringBuilder("Exception extracting parameters: ");
sb.append(e.getMessage());
throw new SignatureException(sb.toString());
}
}
} catch (IOException e2) {
StringBuilder sb2 = new StringBuilder("IOException decoding parameters: ");
sb2.append(e2.getMessage());
throw new SignatureException(sb2.toString());
}
}
private static String e(C15314gnC c15314gnC) {
return InterfaceC15405gph.a.equals(c15314gnC) ? "MD5" : InterfaceC15406gpi.d.equals(c15314gnC) ? "SHA1" : InterfaceC15407gpj.e.equals(c15314gnC) ? "SHA224" : InterfaceC15407gpj.a.equals(c15314gnC) ? "SHA256" : InterfaceC15407gpj.c.equals(c15314gnC) ? "SHA384" : InterfaceC15407gpj.d.equals(c15314gnC) ? "SHA512" : InterfaceC15412gpo.d.equals(c15314gnC) ? "RIPEMD128" : InterfaceC15412gpo.c.equals(c15314gnC) ? "RIPEMD160" : InterfaceC15412gpo.b.equals(c15314gnC) ? "RIPEMD256" : goY.e.equals(c15314gnC) ? "GOST3411" : c15314gnC.d;
}
/* JADX INFO: Access modifiers changed from: package-private */
public static String d(C15423gpz c15423gpz) {
InterfaceC15342gnr interfaceC15342gnr = c15423gpz.a;
if (interfaceC15342gnr != null && !d.equals(interfaceC15342gnr)) {
if (c15423gpz.e.equals(InterfaceC15405gph.b_)) {
C15403gpf e = C15403gpf.e(interfaceC15342gnr);
StringBuilder sb = new StringBuilder();
sb.append(e(e.e.e));
sb.append("withRSAandMGF1");
return sb.toString();
}
if (c15423gpz.e.equals(InterfaceC15445gqn.a)) {
AbstractC15317gnH a = AbstractC15317gnH.a(interfaceC15342gnr);
StringBuilder sb2 = new StringBuilder();
sb2.append(e((C15314gnC) a.d(0)));
sb2.append("withECDSA");
return sb2.toString();
}
}
Provider provider = Security.getProvider("SC");
if (provider != null) {
StringBuilder sb3 = new StringBuilder("Alg.Alias.Signature.");
sb3.append(c15423gpz.e.d);
String property = provider.getProperty(sb3.toString());
if (property != null) {
return property;
}
}
Provider[] providers = Security.getProviders();
for (int i = 0; i != providers.length; i++) {
Provider provider2 = providers[i];
StringBuilder sb4 = new StringBuilder("Alg.Alias.Signature.");
sb4.append(c15423gpz.e.d);
String property2 = provider2.getProperty(sb4.toString());
if (property2 != null) {
return property2;
}
}
return c15423gpz.e.d;
}
}