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

import com.google.android.gms.internal.p002firebaseauthapi.zzqk;
import java.security.GeneralSecurityException;
import javax.annotation.Nullable;
/* compiled from: com.google.firebase:firebase-auth@@23.1.0 */
/* renamed from: com.google.android.gms.internal.firebase-auth-api.zzqd  reason: invalid package */
/* loaded from: classes3.dex */
public final class zzqd extends zzqo {
    private final zzqk zza;
    private final zzze zzb;
    private final zzzc zzc;
    @Nullable
    private final Integer zzd;

    public static zza zzb() {
        return new zza();
    }

    @Override // com.google.android.gms.internal.p002firebaseauthapi.zzbp
    @Nullable
    public final Integer zza() {
        return this.zzd;
    }

    public final zzqk zzc() {
        return this.zza;
    }

    public final zzzc zzd() {
        return this.zzc;
    }

    public final zzze zze() {
        return this.zzb;
    }

    private zzqd(zzqk zzqkVar, zzze zzzeVar, zzzc zzzcVar, @Nullable Integer num) {
        this.zza = zzqkVar;
        this.zzb = zzzeVar;
        this.zzc = zzzcVar;
        this.zzd = num;
    }

    /* compiled from: com.google.firebase:firebase-auth@@23.1.0 */
    /* renamed from: com.google.android.gms.internal.firebase-auth-api.zzqd$zza */
    /* loaded from: classes3.dex */
    public static class zza {
        @Nullable
        private zzqk zza;
        @Nullable
        private zzze zzb;
        @Nullable
        private Integer zzc;

        public final zza zza(zzqk zzqkVar) {
            this.zza = zzqkVar;
            return this;
        }

        public final zza zza(zzze zzzeVar) {
            this.zzb = zzzeVar;
            return this;
        }

        public final zza zza(@Nullable Integer num) {
            this.zzc = num;
            return this;
        }

        public final zzqd zza() throws GeneralSecurityException {
            zzzc zza;
            zzqk zzqkVar = this.zza;
            if (zzqkVar == null || this.zzb == null) {
                throw new GeneralSecurityException("Cannot build without parameters and/or key material");
            }
            if (zzqkVar.zzc() != this.zzb.zza()) {
                throw new GeneralSecurityException("Key size mismatch");
            }
            if (this.zza.zza() && this.zzc == null) {
                throw new GeneralSecurityException("Cannot create key without ID requirement with parameters with ID requirement");
            }
            if (!this.zza.zza() && this.zzc != null) {
                throw new GeneralSecurityException("Cannot create key with ID requirement with parameters without ID requirement");
            }
            if (this.zza.zzf() == zzqk.zzb.zzd) {
                zza = zzog.zza;
            } else if (this.zza.zzf() == zzqk.zzb.zzc || this.zza.zzf() == zzqk.zzb.zzb) {
                zza = zzog.zza(this.zzc.intValue());
            } else if (this.zza.zzf() == zzqk.zzb.zza) {
                zza = zzog.zzb(this.zzc.intValue());
            } else {
                throw new IllegalStateException("Unknown HmacParameters.Variant: " + String.valueOf(this.zza.zzf()));
            }
            return new zzqd(this.zza, this.zzb, zza, this.zzc);
        }

        private zza() {
            this.zza = null;
            this.zzb = null;
            this.zzc = null;
        }
    }
}
