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

import Z0.o;
import com.google.android.gms.internal.p002firebaseauthapi.zzeg;
import java.security.GeneralSecurityException;

/* JADX INFO: loaded from: classes3.dex */
public final class zzed extends zzcp {
    private final zzeg zza;
    private final zzzo zzb;
    private final zzzn zzc;
    private final Integer zzd;

    private zzed(zzeg zzegVar, zzzo zzzoVar, zzzn zzznVar, Integer num) {
        this.zza = zzegVar;
        this.zzb = zzzoVar;
        this.zzc = zzznVar;
        this.zzd = num;
    }

    public static zzed zza(zzeg.zza zzaVar, zzzo zzzoVar, Integer num) throws GeneralSecurityException {
        zzzn zzznVarZzb;
        zzeg.zza zzaVar2 = zzeg.zza.zzc;
        if (zzaVar != zzaVar2 && num == null) {
            throw new GeneralSecurityException(o.o("For given Variant ", String.valueOf(zzaVar), " the value of idRequirement must be non-null"));
        }
        if (zzaVar == zzaVar2 && num != null) {
            throw new GeneralSecurityException("For given Variant NO_PREFIX the value of idRequirement must be null");
        }
        if (zzzoVar.zza() != 32) {
            throw new GeneralSecurityException(o.l("ChaCha20Poly1305 key must be constructed with key of length 32 bytes, not ", zzzoVar.zza()));
        }
        zzeg zzegVarZza = zzeg.zza(zzaVar);
        if (zzegVarZza.zzb() == zzaVar2) {
            zzznVarZzb = zzor.zza;
        } else if (zzegVarZza.zzb() == zzeg.zza.zzb) {
            zzznVarZzb = zzor.zza(num.intValue());
        } else {
            if (zzegVarZza.zzb() != zzeg.zza.zza) {
                throw new IllegalStateException("Unknown Variant: ".concat(String.valueOf(zzegVarZza.zzb())));
            }
            zzznVarZzb = zzor.zzb(num.intValue());
        }
        return new zzed(zzegVarZza, zzzoVar, zzznVarZzb, num);
    }

    public final zzeg zzb() {
        return this.zza;
    }

    public final zzzn zzc() {
        return this.zzc;
    }

    public final zzzo zzd() {
        return this.zzb;
    }

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