package com.google.android.gms.internal.p002firebaseauthapi; import java.nio.ByteBuffer; import java.security.GeneralSecurityException; /* loaded from: classes.dex */ public final class zzfv extends zzcv { private final zzga zza; private final zzwj zzb; private final zzwi zzc; private final Integer zzd; private zzfv(zzga zzgaVar, zzwj zzwjVar, zzwi zzwiVar, Integer num) { this.zza = zzgaVar; this.zzb = zzwjVar; this.zzc = zzwiVar; this.zzd = num; } public static zzfv zza(zzfz zzfzVar, zzwj zzwjVar, Integer num) { zzwi zzb; zzfz zzfzVar2 = zzfz.zzc; if (zzfzVar != zzfzVar2 && num == null) { throw new GeneralSecurityException("For given Variant " + zzfzVar.toString() + " the value of idRequirement must be non-null"); } if (zzfzVar == zzfzVar2 && num != null) { throw new GeneralSecurityException("For given Variant NO_PREFIX the value of idRequirement must be null"); } if (zzwjVar.zza() != 32) { throw new GeneralSecurityException("ChaCha20Poly1305 key must be constructed with key of length 32 bytes, not " + zzwjVar.zza()); } zzga zzb2 = zzga.zzb(zzfzVar); if (zzb2.zza() == zzfzVar2) { zzb = zzwi.zzb(new byte[0]); } else if (zzb2.zza() == zzfz.zzb) { zzb = zzwi.zzb(ByteBuffer.allocate(5).put((byte) 0).putInt(num.intValue()).array()); } else { if (zzb2.zza() != zzfz.zza) { throw new IllegalStateException("Unknown Variant: ".concat(zzb2.zza().toString())); } zzb = zzwi.zzb(ByteBuffer.allocate(5).put((byte) 1).putInt(num.intValue()).array()); } return new zzfv(zzb2, zzwjVar, zzb, num); } }