package B2;

import F2.A;
import F2.B;
import F2.C0061g;
import F2.C0062h;
import F2.C0064j;
import F2.C0065k;
import F2.C0066l;
import F2.C0068n;
import F2.C0070p;
import F2.C0071q;
import F2.C0073t;
import F2.C0075v;
import F2.C0076w;
import F2.C0077x;
import F2.C0079z;
import F2.D;
import F2.E;
import F2.F;
import F2.G;
import F2.H;
import F2.I;
import F2.J;
import F2.L;
import F2.O;
import F2.P;
import F2.Q;
import F2.T;
import F2.V;
import F2.l0;
import F2.m0;
import F2.n0;
import F2.o0;
import F2.p0;
import F2.q0;
import F2.t0;
import F2.u0;
import F2.v0;
import com.google.crypto.tink.shaded.protobuf.AbstractC0472a;
import com.google.crypto.tink.shaded.protobuf.AbstractC0479h;
import com.google.crypto.tink.shaded.protobuf.C0478g;
import com.google.crypto.tink.shaded.protobuf.C0485n;
import io.flutter.embedding.android.AndroidTouchProcessor;
import java.security.GeneralSecurityException;
import java.security.InvalidAlgorithmParameterException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/* JADX INFO: loaded from: classes.dex */
public final class n extends A2.e {

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public final /* synthetic */ int f169l = 0;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public final /* synthetic */ A2.f f170m;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public n(u2.f fVar, byte b2, boolean z5) {
        super(n0.class);
        this.f170m = fVar;
    }

    @Override // A2.e
    public final AbstractC0472a g(AbstractC0472a abstractC0472a) {
        switch (this.f169l) {
            case 0:
                T t4 = (T) abstractC0472a;
                P pD = Q.D();
                ((f) this.f170m).getClass();
                pD.e();
                Q.w((Q) pD.f5805l);
                V vA = t4.A();
                pD.e();
                Q.x((Q) pD.f5805l, vA);
                byte[] bArrA = G2.n.a(t4.z());
                C0478g c0478gC = AbstractC0479h.c(bArrA, 0, bArrA.length);
                pD.e();
                Q.y((Q) pD.f5805l, c0478gC);
                return (Q) pD.b();
            case 1:
                C0064j c0064j = (C0064j) abstractC0472a;
                d[] dVarArr = {new d(3, G2.k.class)};
                HashMap map = new HashMap();
                for (d dVar : dVarArr) {
                    boolean zContainsKey = map.containsKey(dVar.f140a);
                    Class cls = dVar.f140a;
                    if (zContainsKey) {
                        throw new IllegalArgumentException("KeyTypeManager constructed with duplicate factories for primitive " + cls.getCanonicalName());
                    }
                    map.put(cls, dVar);
                }
                if (dVarArr.length > 0) {
                    Class cls2 = dVarArr[0].f140a;
                }
                Collections.unmodifiableMap(map);
                C0068n c0068nY = c0064j.y();
                C0065k c0065kD = C0066l.D();
                C0070p c0070pA = c0068nY.A();
                c0065kD.e();
                C0066l.x((C0066l) c0065kD.f5805l, c0070pA);
                byte[] bArrA2 = G2.n.a(c0068nY.z());
                C0478g c0478gC2 = AbstractC0479h.c(bArrA2, 0, bArrA2.length);
                c0065kD.e();
                C0066l.y((C0066l) c0065kD.f5805l, c0478gC2);
                c0065kD.e();
                C0066l.w((C0066l) c0065kD.f5805l);
                C0066l c0066l = (C0066l) c0065kD.b();
                d[] dVarArr2 = {new d(1, t2.j.class)};
                HashMap map2 = new HashMap();
                for (d dVar2 : dVarArr2) {
                    boolean zContainsKey2 = map2.containsKey(dVar2.f140a);
                    Class cls3 = dVar2.f140a;
                    if (zContainsKey2) {
                        throw new IllegalArgumentException("KeyTypeManager constructed with duplicate factories for primitive " + cls3.getCanonicalName());
                    }
                    map2.put(cls3, dVar2);
                }
                if (dVarArr2.length > 0) {
                    Class cls4 = dVarArr2[0].f140a;
                }
                Collections.unmodifiableMap(map2);
                T tZ = c0064j.z();
                P pD2 = Q.D();
                pD2.e();
                Q.w((Q) pD2.f5805l);
                V vA2 = tZ.A();
                pD2.e();
                Q.x((Q) pD2.f5805l, vA2);
                byte[] bArrA3 = G2.n.a(tZ.z());
                C0478g c0478gC3 = AbstractC0479h.c(bArrA3, 0, bArrA3.length);
                pD2.e();
                Q.y((Q) pD2.f5805l, c0478gC3);
                Q q = (Q) pD2.b();
                C0061g c0061gC = C0062h.C();
                c0061gC.e();
                C0062h.x((C0062h) c0061gC.f5805l, c0066l);
                c0061gC.e();
                C0062h.y((C0062h) c0061gC.f5805l, q);
                ((u2.f) this.f170m).getClass();
                c0061gC.e();
                C0062h.w((C0062h) c0061gC.f5805l);
                return (C0062h) c0061gC.b();
            case 2:
                C0073t c0073t = (C0073t) abstractC0472a;
                C0071q c0071qC = F2.r.C();
                byte[] bArrA4 = G2.n.a(c0073t.y());
                C0478g c0478gC4 = AbstractC0479h.c(bArrA4, 0, bArrA4.length);
                c0071qC.e();
                F2.r.y((F2.r) c0071qC.f5805l, c0478gC4);
                C0075v c0075vZ = c0073t.z();
                c0071qC.e();
                F2.r.x((F2.r) c0071qC.f5805l, c0075vZ);
                ((u2.f) this.f170m).getClass();
                c0071qC.e();
                F2.r.w((F2.r) c0071qC.f5805l);
                return (F2.r) c0071qC.b();
            case 3:
                C0076w c0076wA = C0077x.A();
                byte[] bArrA5 = G2.n.a(((C0079z) abstractC0472a).x());
                C0478g c0478gC5 = AbstractC0479h.c(bArrA5, 0, bArrA5.length);
                c0076wA.e();
                C0077x.x((C0077x) c0076wA.f5805l, c0478gC5);
                ((u2.f) this.f170m).getClass();
                c0076wA.e();
                C0077x.w((C0077x) c0076wA.f5805l);
                return (C0077x) c0076wA.b();
            case 4:
                A A5 = B.A();
                byte[] bArrA6 = G2.n.a(((D) abstractC0472a).x());
                C0478g c0478gC6 = AbstractC0479h.c(bArrA6, 0, bArrA6.length);
                A5.e();
                B.x((B) A5.f5805l, c0478gC6);
                ((u2.f) this.f170m).getClass();
                A5.e();
                B.w((B) A5.f5805l);
                return (B) A5.b();
            case 5:
                I iA = J.A();
                ((u2.f) this.f170m).getClass();
                iA.e();
                J.w((J) iA.f5805l);
                byte[] bArrA7 = G2.n.a(32);
                C0478g c0478gC7 = AbstractC0479h.c(bArrA7, 0, bArrA7.length);
                iA.e();
                J.x((J) iA.f5805l, c0478gC7);
                return (J) iA.b();
            case 6:
                l0 l0VarA = m0.A();
                l0VarA.e();
                m0.x((m0) l0VarA.f5805l, (n0) abstractC0472a);
                ((u2.f) this.f170m).getClass();
                l0VarA.e();
                m0.w((m0) l0VarA.f5805l);
                return (m0) l0VarA.b();
            case 7:
                o0 o0VarA = p0.A();
                o0VarA.e();
                p0.x((p0) o0VarA.f5805l, (q0) abstractC0472a);
                ((u2.f) this.f170m).getClass();
                o0VarA.e();
                p0.w((p0) o0VarA.f5805l);
                return (p0) o0VarA.b();
            case 8:
                t0 t0VarA = u0.A();
                ((u2.f) this.f170m).getClass();
                t0VarA.e();
                u0.w((u0) t0VarA.f5805l);
                byte[] bArrA8 = G2.n.a(32);
                C0478g c0478gC8 = AbstractC0479h.c(bArrA8, 0, bArrA8.length);
                t0VarA.e();
                u0.x((u0) t0VarA.f5805l, c0478gC8);
                return (u0) t0VarA.b();
            default:
                E eA = F.A();
                byte[] bArrA9 = G2.n.a(((H) abstractC0472a).x());
                C0478g c0478gC9 = AbstractC0479h.c(bArrA9, 0, bArrA9.length);
                eA.e();
                F.x((F) eA.f5805l, c0478gC9);
                ((u2.f) this.f170m).getClass();
                eA.e();
                F.w((F) eA.f5805l);
                return (F) eA.b();
        }
    }

    @Override // A2.e
    public Map h() {
        switch (this.f169l) {
            case 0:
                HashMap map = new HashMap();
                O o5 = O.SHA256;
                map.put("HMAC_SHA256_128BITTAG", f.h(32, 16, o5, 1));
                map.put("HMAC_SHA256_128BITTAG_RAW", f.h(32, 16, o5, 3));
                map.put("HMAC_SHA256_256BITTAG", f.h(32, 32, o5, 1));
                map.put("HMAC_SHA256_256BITTAG_RAW", f.h(32, 32, o5, 3));
                O o6 = O.SHA512;
                map.put("HMAC_SHA512_128BITTAG", f.h(64, 16, o6, 1));
                map.put("HMAC_SHA512_128BITTAG_RAW", f.h(64, 16, o6, 3));
                map.put("HMAC_SHA512_256BITTAG", f.h(64, 32, o6, 1));
                map.put("HMAC_SHA512_256BITTAG_RAW", f.h(64, 32, o6, 3));
                map.put("HMAC_SHA512_512BITTAG", f.h(64, 64, o6, 1));
                map.put("HMAC_SHA512_512BITTAG_RAW", f.h(64, 64, o6, 3));
                return Collections.unmodifiableMap(map);
            case 1:
                HashMap map2 = new HashMap();
                map2.put("AES128_CTR_HMAC_SHA256", u2.f.i(16, 16, 1));
                map2.put("AES128_CTR_HMAC_SHA256_RAW", u2.f.i(16, 16, 3));
                map2.put("AES256_CTR_HMAC_SHA256", u2.f.i(32, 32, 1));
                map2.put("AES256_CTR_HMAC_SHA256_RAW", u2.f.i(32, 32, 3));
                return Collections.unmodifiableMap(map2);
            case 2:
                HashMap map3 = new HashMap();
                map3.put("AES128_EAX", u2.f.h(16, 1));
                map3.put("AES128_EAX_RAW", u2.f.h(16, 3));
                map3.put("AES256_EAX", u2.f.h(32, 1));
                map3.put("AES256_EAX_RAW", u2.f.h(32, 3));
                return Collections.unmodifiableMap(map3);
            case 3:
                HashMap map4 = new HashMap();
                map4.put("AES128_GCM", u2.f.j(16, 1));
                map4.put("AES128_GCM_RAW", u2.f.j(16, 3));
                map4.put("AES256_GCM", u2.f.j(32, 1));
                map4.put("AES256_GCM_RAW", u2.f.j(32, 3));
                return Collections.unmodifiableMap(map4);
            case 4:
                HashMap map5 = new HashMap();
                map5.put("AES128_GCM_SIV", u2.f.k(16, 1));
                map5.put("AES128_GCM_SIV_RAW", u2.f.k(16, 3));
                map5.put("AES256_GCM_SIV", u2.f.k(32, 1));
                map5.put("AES256_GCM_SIV_RAW", u2.f.k(32, 3));
                return Collections.unmodifiableMap(map5);
            case 5:
                HashMap map6 = new HashMap();
                map6.put("CHACHA20_POLY1305", new A2.d(L.w(), 1));
                map6.put("CHACHA20_POLY1305_RAW", new A2.d(L.w(), 3));
                return Collections.unmodifiableMap(map6);
            case 6:
            case 7:
            default:
                return super.h();
            case 8:
                HashMap map7 = new HashMap();
                map7.put("XCHACHA20_POLY1305", new A2.d(v0.w(), 1));
                map7.put("XCHACHA20_POLY1305_RAW", new A2.d(v0.w(), 3));
                return Collections.unmodifiableMap(map7);
            case AndroidTouchProcessor.PointerChange.PAN_ZOOM_END /* 9 */:
                HashMap map8 = new HashMap();
                G gY = H.y();
                gY.e();
                H.w((H) gY.f5805l);
                map8.put("AES256_SIV", new A2.d((H) gY.b(), 1));
                G gY2 = H.y();
                gY2.e();
                H.w((H) gY2.f5805l);
                map8.put("AES256_SIV_RAW", new A2.d((H) gY2.b(), 3));
                return Collections.unmodifiableMap(map8);
        }
    }

    @Override // A2.e
    public final AbstractC0472a i(AbstractC0479h abstractC0479h) {
        switch (this.f169l) {
            case 0:
                return T.C(abstractC0479h, C0485n.a());
            case 1:
                return C0064j.B(abstractC0479h, C0485n.a());
            case 2:
                return C0073t.B(abstractC0479h, C0485n.a());
            case 3:
                return C0079z.z(abstractC0479h, C0485n.a());
            case 4:
                return D.z(abstractC0479h, C0485n.a());
            case 5:
                return L.x(abstractC0479h, C0485n.a());
            case 6:
                return n0.y(abstractC0479h, C0485n.a());
            case 7:
                return q0.A(abstractC0479h, C0485n.a());
            case 8:
                return v0.x(abstractC0479h, C0485n.a());
            default:
                return H.z(abstractC0479h, C0485n.a());
        }
    }

    @Override // A2.e
    public final void j(AbstractC0472a abstractC0472a) throws GeneralSecurityException {
        switch (this.f169l) {
            case 0:
                T t4 = (T) abstractC0472a;
                if (t4.z() < 16) {
                    throw new GeneralSecurityException("key too short");
                }
                f.j(t4.A());
                return;
            case 1:
                C0064j c0064j = (C0064j) abstractC0472a;
                d[] dVarArr = {new d(3, G2.k.class)};
                HashMap map = new HashMap();
                for (d dVar : dVarArr) {
                    boolean zContainsKey = map.containsKey(dVar.f140a);
                    Class cls = dVar.f140a;
                    if (zContainsKey) {
                        throw new IllegalArgumentException("KeyTypeManager constructed with duplicate factories for primitive " + cls.getCanonicalName());
                    }
                    map.put(cls, dVar);
                }
                if (dVarArr.length > 0) {
                    Class cls2 = dVarArr[0].f140a;
                }
                Collections.unmodifiableMap(map);
                C0068n c0068nY = c0064j.y();
                G2.o.a(c0068nY.z());
                C0070p c0070pA = c0068nY.A();
                if (c0070pA.y() < 12 || c0070pA.y() > 16) {
                    throw new GeneralSecurityException("invalid IV size");
                }
                d[] dVarArr2 = {new d(1, t2.j.class)};
                HashMap map2 = new HashMap();
                for (d dVar2 : dVarArr2) {
                    boolean zContainsKey2 = map2.containsKey(dVar2.f140a);
                    Class cls3 = dVar2.f140a;
                    if (zContainsKey2) {
                        throw new IllegalArgumentException("KeyTypeManager constructed with duplicate factories for primitive " + cls3.getCanonicalName());
                    }
                    map2.put(cls3, dVar2);
                }
                if (dVarArr2.length > 0) {
                    Class cls4 = dVarArr2[0].f140a;
                }
                Collections.unmodifiableMap(map2);
                T tZ = c0064j.z();
                if (tZ.z() < 16) {
                    throw new GeneralSecurityException("key too short");
                }
                f.j(tZ.A());
                G2.o.a(c0064j.y().z());
                return;
            case 2:
                C0073t c0073t = (C0073t) abstractC0472a;
                G2.o.a(c0073t.y());
                if (c0073t.z().y() != 12 && c0073t.z().y() != 16) {
                    throw new GeneralSecurityException("invalid IV size; acceptable values have 12 or 16 bytes");
                }
                return;
            case 3:
                G2.o.a(((C0079z) abstractC0472a).x());
                return;
            case 4:
                G2.o.a(((D) abstractC0472a).x());
                return;
            case 5:
                return;
            case 6:
                return;
            case 7:
                q0 q0Var = (q0) abstractC0472a;
                if (q0Var.y().isEmpty() || !q0Var.z()) {
                    throw new GeneralSecurityException("invalid key format: missing KEK URI or DEK template");
                }
                return;
            case 8:
                return;
            default:
                H h3 = (H) abstractC0472a;
                if (h3.x() == 64) {
                    return;
                }
                throw new InvalidAlgorithmParameterException("invalid key size: " + h3.x() + ". Valid keys must have 64 bytes.");
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public n(u2.f fVar, byte b2, byte b4) {
        super(q0.class);
        this.f170m = fVar;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public n(u2.f fVar, char c6) {
        super(C0079z.class);
        this.f170m = fVar;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public n(u2.f fVar, byte b2) {
        super(C0073t.class);
        this.f170m = fVar;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public n(u2.f fVar, int i) {
        super(D.class);
        this.f170m = fVar;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public n(u2.f fVar, short s5) {
        super(L.class);
        this.f170m = fVar;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public n(u2.f fVar, byte b2, char c6) {
        super(v0.class);
        this.f170m = fVar;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public n(u2.f fVar, byte b2, int i) {
        super(H.class);
        this.f170m = fVar;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public n(u2.f fVar) {
        super(C0064j.class);
        this.f170m = fVar;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public n(f fVar) {
        super(T.class);
        this.f170m = fVar;
    }
}
