package M3;

import F.I;
import X3.A;
import X3.B;
import X3.C0816g;
import X3.C0817h;
import X3.C0819j;
import X3.C0820k;
import X3.C0821l;
import X3.C0823n;
import X3.C0825p;
import X3.C0826q;
import X3.C0828t;
import X3.C0830v;
import X3.C0831w;
import X3.C0832x;
import X3.C0834z;
import X3.D;
import X3.E;
import X3.F;
import X3.G;
import X3.H;
import X3.J;
import X3.L;
import X3.O;
import X3.P;
import X3.Q;
import X3.T;
import X3.V;
import X3.l0;
import X3.m0;
import X3.n0;
import X3.o0;
import X3.p0;
import X3.q0;
import X3.t0;
import X3.u0;
import X3.v0;
import com.google.crypto.tink.shaded.protobuf.AbstractC1253a;
import com.google.crypto.tink.shaded.protobuf.AbstractC1261i;
import com.google.crypto.tink.shaded.protobuf.C1260h;
import com.google.crypto.tink.shaded.protobuf.C1267o;
import java.security.GeneralSecurityException;
import java.security.InvalidAlgorithmParameterException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/* JADX INFO: loaded from: classes3.dex */
public final class g extends I {

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ S3.d f5060c;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public g(h hVar, byte b5, boolean z6) {
        super(n0.class);
        this.f5060c = hVar;
    }

    @Override // F.I
    public final AbstractC1253a a(AbstractC1253a abstractC1253a) {
        switch (this.f5059b) {
            case 0:
                C0819j c0819j = (C0819j) abstractC1253a;
                f[] fVarArr = {new f(Y3.p.class, 1)};
                HashMap map = new HashMap();
                for (f fVar : fVarArr) {
                    boolean zContainsKey = map.containsKey(fVar.f5057a);
                    Class cls = fVar.f5057a;
                    if (zContainsKey) {
                        throw new IllegalArgumentException(A0.a.l(cls, new StringBuilder("KeyTypeManager constructed with duplicate factories for primitive ")));
                    }
                    map.put(cls, fVar);
                }
                if (fVarArr.length > 0) {
                    Class cls2 = fVarArr[0].f5057a;
                }
                Collections.unmodifiableMap(map);
                C0823n c0823nX = c0819j.x();
                C0820k c0820kC = C0821l.C();
                C0825p c0825pZ = c0823nX.z();
                c0820kC.d();
                C0821l.w((C0821l) c0820kC.f13838b, c0825pZ);
                byte[] bArrA = Y3.s.a(c0823nX.y());
                C1260h c1260hH = AbstractC1261i.h(bArrA, 0, bArrA.length);
                c0820kC.d();
                C0821l.x((C0821l) c0820kC.f13838b, c1260hH);
                c0820kC.d();
                C0821l.v((C0821l) c0820kC.f13838b);
                C0821l c0821l = (C0821l) c0820kC.a();
                f[] fVarArr2 = {new f(L3.j.class, 11)};
                HashMap map2 = new HashMap();
                for (f fVar2 : fVarArr2) {
                    boolean zContainsKey2 = map2.containsKey(fVar2.f5057a);
                    Class cls3 = fVar2.f5057a;
                    if (zContainsKey2) {
                        throw new IllegalArgumentException(A0.a.l(cls3, new StringBuilder("KeyTypeManager constructed with duplicate factories for primitive ")));
                    }
                    map2.put(cls3, fVar2);
                }
                if (fVarArr2.length > 0) {
                    Class cls4 = fVarArr2[0].f5057a;
                }
                Collections.unmodifiableMap(map2);
                T tY = c0819j.y();
                P pC = Q.C();
                pC.d();
                Q.v((Q) pC.f13838b);
                V vZ = tY.z();
                pC.d();
                Q.w((Q) pC.f13838b, vZ);
                byte[] bArrA2 = Y3.s.a(tY.y());
                C1260h c1260hH2 = AbstractC1261i.h(bArrA2, 0, bArrA2.length);
                pC.d();
                Q.x((Q) pC.f13838b, c1260hH2);
                Q q6 = (Q) pC.a();
                C0816g c0816gB = C0817h.B();
                c0816gB.d();
                C0817h.w((C0817h) c0816gB.f13838b, c0821l);
                c0816gB.d();
                C0817h.x((C0817h) c0816gB.f13838b, q6);
                ((h) this.f5060c).getClass();
                c0816gB.d();
                C0817h.v((C0817h) c0816gB.f13838b);
                return (C0817h) c0816gB.a();
            case 1:
                C0828t c0828t = (C0828t) abstractC1253a;
                C0826q c0826qB = X3.r.B();
                byte[] bArrA3 = Y3.s.a(c0828t.x());
                C1260h c1260hH3 = AbstractC1261i.h(bArrA3, 0, bArrA3.length);
                c0826qB.d();
                X3.r.x((X3.r) c0826qB.f13838b, c1260hH3);
                C0830v c0830vY = c0828t.y();
                c0826qB.d();
                X3.r.w((X3.r) c0826qB.f13838b, c0830vY);
                ((h) this.f5060c).getClass();
                c0826qB.d();
                X3.r.v((X3.r) c0826qB.f13838b);
                return (X3.r) c0826qB.a();
            case 2:
                C0831w c0831wZ = C0832x.z();
                byte[] bArrA4 = Y3.s.a(((C0834z) abstractC1253a).w());
                C1260h c1260hH4 = AbstractC1261i.h(bArrA4, 0, bArrA4.length);
                c0831wZ.d();
                C0832x.w((C0832x) c0831wZ.f13838b, c1260hH4);
                ((h) this.f5060c).getClass();
                c0831wZ.d();
                C0832x.v((C0832x) c0831wZ.f13838b);
                return (C0832x) c0831wZ.a();
            case 3:
                A aZ = B.z();
                byte[] bArrA5 = Y3.s.a(((D) abstractC1253a).w());
                C1260h c1260hH5 = AbstractC1261i.h(bArrA5, 0, bArrA5.length);
                aZ.d();
                B.w((B) aZ.f13838b, c1260hH5);
                ((h) this.f5060c).getClass();
                aZ.d();
                B.v((B) aZ.f13838b);
                return (B) aZ.a();
            case 4:
                X3.I iZ = J.z();
                ((h) this.f5060c).getClass();
                iZ.d();
                J.v((J) iZ.f13838b);
                byte[] bArrA6 = Y3.s.a(32);
                C1260h c1260hH6 = AbstractC1261i.h(bArrA6, 0, bArrA6.length);
                iZ.d();
                J.w((J) iZ.f13838b, c1260hH6);
                return (J) iZ.a();
            case 5:
                l0 l0VarZ = m0.z();
                l0VarZ.d();
                m0.w((m0) l0VarZ.f13838b, (n0) abstractC1253a);
                ((h) this.f5060c).getClass();
                l0VarZ.d();
                m0.v((m0) l0VarZ.f13838b);
                return (m0) l0VarZ.a();
            case 6:
                o0 o0VarZ = p0.z();
                o0VarZ.d();
                p0.w((p0) o0VarZ.f13838b, (q0) abstractC1253a);
                ((h) this.f5060c).getClass();
                o0VarZ.d();
                p0.v((p0) o0VarZ.f13838b);
                return (p0) o0VarZ.a();
            case 7:
                t0 t0VarZ = u0.z();
                ((h) this.f5060c).getClass();
                t0VarZ.d();
                u0.v((u0) t0VarZ.f13838b);
                byte[] bArrA7 = Y3.s.a(32);
                C1260h c1260hH7 = AbstractC1261i.h(bArrA7, 0, bArrA7.length);
                t0VarZ.d();
                u0.w((u0) t0VarZ.f13838b, c1260hH7);
                return (u0) t0VarZ.a();
            case 8:
                E eZ = F.z();
                byte[] bArrA8 = Y3.s.a(((H) abstractC1253a).w());
                C1260h c1260hH8 = AbstractC1261i.h(bArrA8, 0, bArrA8.length);
                eZ.d();
                F.w((F) eZ.f13838b, c1260hH8);
                ((h) this.f5060c).getClass();
                eZ.d();
                F.v((F) eZ.f13838b);
                return (F) eZ.a();
            default:
                T t6 = (T) abstractC1253a;
                P pC2 = Q.C();
                ((T3.c) this.f5060c).getClass();
                pC2.d();
                Q.v((Q) pC2.f13838b);
                V vZ2 = t6.z();
                pC2.d();
                Q.w((Q) pC2.f13838b, vZ2);
                byte[] bArrA9 = Y3.s.a(t6.y());
                C1260h c1260hH9 = AbstractC1261i.h(bArrA9, 0, bArrA9.length);
                pC2.d();
                Q.x((Q) pC2.f13838b, c1260hH9);
                return (Q) pC2.a();
        }
    }

    @Override // F.I
    public Map g() {
        switch (this.f5059b) {
            case 0:
                HashMap map = new HashMap();
                map.put("AES128_CTR_HMAC_SHA256", h.i(16, 16, 1));
                map.put("AES128_CTR_HMAC_SHA256_RAW", h.i(16, 16, 3));
                map.put("AES256_CTR_HMAC_SHA256", h.i(32, 32, 1));
                map.put("AES256_CTR_HMAC_SHA256_RAW", h.i(32, 32, 3));
                return Collections.unmodifiableMap(map);
            case 1:
                HashMap map2 = new HashMap();
                map2.put("AES128_EAX", h.h(16, 1));
                map2.put("AES128_EAX_RAW", h.h(16, 3));
                map2.put("AES256_EAX", h.h(32, 1));
                map2.put("AES256_EAX_RAW", h.h(32, 3));
                return Collections.unmodifiableMap(map2);
            case 2:
                HashMap map3 = new HashMap();
                map3.put("AES128_GCM", h.j(16, 1));
                map3.put("AES128_GCM_RAW", h.j(16, 3));
                map3.put("AES256_GCM", h.j(32, 1));
                map3.put("AES256_GCM_RAW", h.j(32, 3));
                return Collections.unmodifiableMap(map3);
            case 3:
                HashMap map4 = new HashMap();
                map4.put("AES128_GCM_SIV", h.k(16, 1));
                map4.put("AES128_GCM_SIV_RAW", h.k(16, 3));
                map4.put("AES256_GCM_SIV", h.k(32, 1));
                map4.put("AES256_GCM_SIV_RAW", h.k(32, 3));
                return Collections.unmodifiableMap(map4);
            case 4:
                HashMap map5 = new HashMap();
                map5.put("CHACHA20_POLY1305", new S3.c(L.v(), 1));
                map5.put("CHACHA20_POLY1305_RAW", new S3.c(L.v(), 3));
                return Collections.unmodifiableMap(map5);
            case 5:
            case 6:
            default:
                return super.g();
            case 7:
                HashMap map6 = new HashMap();
                map6.put("XCHACHA20_POLY1305", new S3.c(v0.v(), 1));
                map6.put("XCHACHA20_POLY1305_RAW", new S3.c(v0.v(), 3));
                return Collections.unmodifiableMap(map6);
            case 8:
                HashMap map7 = new HashMap();
                G gX = H.x();
                gX.d();
                H.v((H) gX.f13838b);
                map7.put("AES256_SIV", new S3.c((H) gX.a(), 1));
                G gX2 = H.x();
                gX2.d();
                H.v((H) gX2.f13838b);
                map7.put("AES256_SIV_RAW", new S3.c((H) gX2.a(), 3));
                return Collections.unmodifiableMap(map7);
            case 9:
                HashMap map8 = new HashMap();
                O o6 = O.SHA256;
                map8.put("HMAC_SHA256_128BITTAG", T3.c.h(32, 16, o6, 1));
                map8.put("HMAC_SHA256_128BITTAG_RAW", T3.c.h(32, 16, o6, 3));
                map8.put("HMAC_SHA256_256BITTAG", T3.c.h(32, 32, o6, 1));
                map8.put("HMAC_SHA256_256BITTAG_RAW", T3.c.h(32, 32, o6, 3));
                O o7 = O.SHA512;
                map8.put("HMAC_SHA512_128BITTAG", T3.c.h(64, 16, o7, 1));
                map8.put("HMAC_SHA512_128BITTAG_RAW", T3.c.h(64, 16, o7, 3));
                map8.put("HMAC_SHA512_256BITTAG", T3.c.h(64, 32, o7, 1));
                map8.put("HMAC_SHA512_256BITTAG_RAW", T3.c.h(64, 32, o7, 3));
                map8.put("HMAC_SHA512_512BITTAG", T3.c.h(64, 64, o7, 1));
                map8.put("HMAC_SHA512_512BITTAG_RAW", T3.c.h(64, 64, o7, 3));
                return Collections.unmodifiableMap(map8);
        }
    }

    @Override // F.I
    public final AbstractC1253a h(AbstractC1261i abstractC1261i) {
        switch (this.f5059b) {
            case 0:
                return C0819j.A(abstractC1261i, C1267o.a());
            case 1:
                return C0828t.A(abstractC1261i, C1267o.a());
            case 2:
                return C0834z.y(abstractC1261i, C1267o.a());
            case 3:
                return D.y(abstractC1261i, C1267o.a());
            case 4:
                return L.w(abstractC1261i, C1267o.a());
            case 5:
                return n0.x(abstractC1261i, C1267o.a());
            case 6:
                return q0.z(abstractC1261i, C1267o.a());
            case 7:
                return v0.w(abstractC1261i, C1267o.a());
            case 8:
                return H.y(abstractC1261i, C1267o.a());
            default:
                return T.B(abstractC1261i, C1267o.a());
        }
    }

    @Override // F.I
    public final void m(AbstractC1253a abstractC1253a) throws GeneralSecurityException {
        switch (this.f5059b) {
            case 0:
                C0819j c0819j = (C0819j) abstractC1253a;
                f[] fVarArr = {new f(Y3.p.class, 1)};
                HashMap map = new HashMap();
                for (f fVar : fVarArr) {
                    boolean zContainsKey = map.containsKey(fVar.f5057a);
                    Class cls = fVar.f5057a;
                    if (zContainsKey) {
                        throw new IllegalArgumentException(A0.a.l(cls, new StringBuilder("KeyTypeManager constructed with duplicate factories for primitive ")));
                    }
                    map.put(cls, fVar);
                }
                if (fVarArr.length > 0) {
                    Class cls2 = fVarArr[0].f5057a;
                }
                Collections.unmodifiableMap(map);
                C0823n c0823nX = c0819j.x();
                Y3.t.a(c0823nX.y());
                C0825p c0825pZ = c0823nX.z();
                if (c0825pZ.x() < 12 || c0825pZ.x() > 16) {
                    throw new GeneralSecurityException("invalid IV size");
                }
                f[] fVarArr2 = {new f(L3.j.class, 11)};
                HashMap map2 = new HashMap();
                for (f fVar2 : fVarArr2) {
                    boolean zContainsKey2 = map2.containsKey(fVar2.f5057a);
                    Class cls3 = fVar2.f5057a;
                    if (zContainsKey2) {
                        throw new IllegalArgumentException(A0.a.l(cls3, new StringBuilder("KeyTypeManager constructed with duplicate factories for primitive ")));
                    }
                    map2.put(cls3, fVar2);
                }
                if (fVarArr2.length > 0) {
                    Class cls4 = fVarArr2[0].f5057a;
                }
                Collections.unmodifiableMap(map2);
                T tY = c0819j.y();
                if (tY.y() < 16) {
                    throw new GeneralSecurityException("key too short");
                }
                T3.c.j(tY.z());
                Y3.t.a(c0819j.x().y());
                return;
            case 1:
                C0828t c0828t = (C0828t) abstractC1253a;
                Y3.t.a(c0828t.x());
                if (c0828t.y().x() != 12 && c0828t.y().x() != 16) {
                    throw new GeneralSecurityException("invalid IV size; acceptable values have 12 or 16 bytes");
                }
                return;
            case 2:
                Y3.t.a(((C0834z) abstractC1253a).w());
                return;
            case 3:
                Y3.t.a(((D) abstractC1253a).w());
                return;
            case 4:
                return;
            case 5:
                return;
            case 6:
                q0 q0Var = (q0) abstractC1253a;
                if (q0Var.x().isEmpty() || !q0Var.y()) {
                    throw new GeneralSecurityException("invalid key format: missing KEK URI or DEK template");
                }
                return;
            case 7:
                return;
            case 8:
                H h5 = (H) abstractC1253a;
                if (h5.w() == 64) {
                    return;
                }
                throw new InvalidAlgorithmParameterException("invalid key size: " + h5.w() + ". Valid keys must have 64 bytes.");
            default:
                T t6 = (T) abstractC1253a;
                if (t6.y() < 16) {
                    throw new GeneralSecurityException("key too short");
                }
                T3.c.j(t6.z());
                return;
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public g(h hVar, byte b5, byte b6) {
        super(q0.class);
        this.f5060c = hVar;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public g(h hVar, char c6) {
        super(C0834z.class);
        this.f5060c = hVar;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public g(h hVar, byte b5) {
        super(C0828t.class);
        this.f5060c = hVar;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public g(h hVar, int i6) {
        super(D.class);
        this.f5060c = hVar;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public g(h hVar, short s6) {
        super(L.class);
        this.f5060c = hVar;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public g(h hVar, byte b5, char c6) {
        super(v0.class);
        this.f5060c = hVar;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public g(h hVar, byte b5, int i6) {
        super(H.class);
        this.f5060c = hVar;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public g(h hVar) {
        super(C0819j.class);
        this.f5060c = hVar;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public g(T3.c cVar) {
        super(T.class);
        this.f5060c = cVar;
    }
}
