package o; import java.security.GeneralSecurityException; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.logging.Logger; import o.FdT; import o.InterfaceC17129uEO; /* loaded from: classes2.dex */ public class WAM implements wbW { private static final Logger a = Logger.getLogger(WAM.class.getName()); /* loaded from: classes2.dex */ public static class Sts implements InterfaceC4280bVg { private final InterfaceC17129uEO.IeS a; private final InterfaceC17129uEO.IeS b; private final FdT e; /* synthetic */ Sts(FdT fdT, byte b) { this(fdT); } private Sts(FdT fdT) { this.e = fdT; if (!(!fdT.e.b.isEmpty())) { this.b = MWX.b; this.a = MWX.b; return; } InterfaceC17129uEO interfaceC17129uEO = UqK.d().a.get(); interfaceC17129uEO = interfaceC17129uEO == null ? UqK.d : interfaceC17129uEO; MWX.d(fdT); this.b = interfaceC17129uEO.d(); this.a = interfaceC17129uEO.d(); } @Override // o.InterfaceC4280bVg public final byte[] d(byte[] bArr, byte[] bArr2) throws GeneralSecurityException { if (bArr.length > 5) { byte[] copyOf = Arrays.copyOf(bArr, 5); byte[] copyOfRange = Arrays.copyOfRange(bArr, 5, bArr.length); List> list = this.e.c.get(new FdT.LWm(copyOf, (byte) 0)); if (list == null) { list = Collections.emptyList(); } for (FdT.HBt hBt : list) { try { byte[] d = hBt.e.d(copyOfRange, bArr2); int i = hBt.d; int length = copyOfRange.length; return d; } catch (GeneralSecurityException e) { WAM.a.info("ciphertext prefix matches a key, but cannot decrypt: ".concat(String.valueOf(e))); } } } List> list2 = this.e.c.get(new FdT.LWm(sPU.b, (byte) 0)); if (list2 == null) { list2 = Collections.emptyList(); } for (FdT.HBt hBt2 : list2) { try { byte[] d2 = hBt2.e.d(bArr, bArr2); int i2 = hBt2.d; int length2 = bArr.length; return d2; } catch (GeneralSecurityException unused) { } } throw new GeneralSecurityException("decryption failed"); } @Override // o.InterfaceC4280bVg public final byte[] b(byte[] bArr, byte[] bArr2) throws GeneralSecurityException { byte[][] bArr3 = new byte[2]; byte[] bArr4 = this.e.a.b; bArr3[0] = bArr4 == null ? null : Arrays.copyOf(bArr4, bArr4.length); bArr3[1] = this.e.a.e.b(bArr, bArr2); byte[] a = vil.a(bArr3); int i = this.e.a.d; int length = bArr.length; return a; } } WAM() { } @Override // o.wbW public final Class c() { return InterfaceC4280bVg.class; } @Override // o.wbW public final Class e() { return InterfaceC4280bVg.class; } public static void a() throws GeneralSecurityException { Jtp.a(new WAM()); } @Override // o.wbW public final /* synthetic */ InterfaceC4280bVg d(FdT fdT) throws GeneralSecurityException { return new Sts(fdT, (byte) 0); } }