package com.google.android.gms.internal.p002firebaseauthapi; import java.nio.ByteBuffer; import java.security.GeneralSecurityException; /* loaded from: classes.dex */ public final class zzff { private zzfp zza = null; private zzwj zzb = null; private Integer zzc = null; /* synthetic */ zzff(zzfe zzfeVar) { } public final zzff zza(Integer num) { this.zzc = num; return this; } public final zzff zzb(zzwj zzwjVar) { this.zzb = zzwjVar; return this; } public final zzff zzc(zzfp zzfpVar) { this.zza = zzfpVar; return this; } public final zzfh zzd() { zzwj zzwjVar; zzwi zzb; zzfp zzfpVar = this.zza; if (zzfpVar == null || (zzwjVar = this.zzb) == null) { throw new GeneralSecurityException("Cannot build without parameters and/or key material"); } if (zzfpVar.zza() != zzwjVar.zza()) { throw new GeneralSecurityException("Key size mismatch"); } if (zzfpVar.zzc() && this.zzc == null) { throw new GeneralSecurityException("Cannot create key without ID requirement with parameters with ID requirement"); } if (!this.zza.zzc() && this.zzc != null) { throw new GeneralSecurityException("Cannot create key with ID requirement with parameters without ID requirement"); } if (this.zza.zzb() == zzfn.zzc) { zzb = zzwi.zzb(new byte[0]); } else if (this.zza.zzb() == zzfn.zzb) { zzb = zzwi.zzb(ByteBuffer.allocate(5).put((byte) 0).putInt(this.zzc.intValue()).array()); } else { if (this.zza.zzb() != zzfn.zza) { throw new IllegalStateException("Unknown AesGcmSivParameters.Variant: ".concat(String.valueOf(this.zza.zzb()))); } zzb = zzwi.zzb(ByteBuffer.allocate(5).put((byte) 1).putInt(this.zzc.intValue()).array()); } return new zzfh(this.zza, this.zzb, zzb, this.zzc, null); } private zzff() { } }