package com.google.android.gms.internal.pal;

import java.security.GeneralSecurityException;

/* JADX INFO: loaded from: classes2.dex */
public final class s8 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final String f21205a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final int f21206b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final hb f21207c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final qa f21208d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final int f21209e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final pb f21210f;

    public s8(ad adVar) throws GeneralSecurityException {
        String strQ = adVar.q();
        this.f21205a = strQ;
        if (strQ.equals(w7.f21315b)) {
            try {
                jb jbVarP = jb.p(adVar.p(), w.a());
                this.f21207c = (hb) u7.b(adVar);
                this.f21206b = jbVarP.n();
                return;
            } catch (zzadi e10) {
                throw new GeneralSecurityException("invalid KeyFormat protobuf, expected AesGcmKeyFormat", e10);
            }
        }
        if (strQ.equals(w7.f21314a)) {
            try {
                sa saVarO = sa.o(adVar.p(), w.a());
                this.f21208d = (qa) u7.b(adVar);
                int iN = saVarO.p().n();
                this.f21209e = iN;
                this.f21206b = iN + saVarO.q().n();
                return;
            } catch (zzadi e11) {
                throw new GeneralSecurityException("invalid KeyFormat protobuf, expected AesCtrHmacAeadKeyFormat", e11);
            }
        }
        if (!strQ.equals(k8.f21030a)) {
            throw new GeneralSecurityException("unsupported AEAD DEM key type: ".concat(String.valueOf(strQ)));
        }
        try {
            rb rbVarP = rb.p(adVar.p(), w.a());
            this.f21210f = (pb) u7.b(adVar);
            this.f21206b = rbVarP.n();
        } catch (zzadi e12) {
            throw new GeneralSecurityException("invalid KeyFormat protobuf, expected AesCtrHmacAeadKeyFormat", e12);
        }
    }
}
