package com.google.android.gms.internal.p002firebaseauthapi; import java.nio.ByteBuffer; import java.security.GeneralSecurityException; /* loaded from: classes.dex */ public final class zzdc { private zzdn zza = null; private zzwj zzb = null; private zzwj zzc = null; private Integer zzd = null; /* synthetic */ zzdc(zzdb zzdbVar) { } public final zzdc zza(zzwj zzwjVar) { this.zzb = zzwjVar; return this; } public final zzdc zzb(zzwj zzwjVar) { this.zzc = zzwjVar; return this; } public final zzdc zzc(Integer num) { this.zzd = num; return this; } public final zzdc zzd(zzdn zzdnVar) { this.zza = zzdnVar; return this; } public final zzde zze() { zzwi zzb; zzdn zzdnVar = this.zza; if (zzdnVar == null) { throw new GeneralSecurityException("Cannot build without parameters"); } zzwj zzwjVar = this.zzb; if (zzwjVar == null || this.zzc == null) { throw new GeneralSecurityException("Cannot build without key material"); } if (zzdnVar.zza() != zzwjVar.zza()) { throw new GeneralSecurityException("AES key size mismatch"); } if (zzdnVar.zzb() != this.zzc.zza()) { throw new GeneralSecurityException("HMAC key size mismatch"); } if (this.zza.zzg() && this.zzd == null) { throw new GeneralSecurityException("Cannot create key without ID requirement with parameters with ID requirement"); } if (!this.zza.zzg() && this.zzd != null) { throw new GeneralSecurityException("Cannot create key with ID requirement with parameters without ID requirement"); } if (this.zza.zzf() == zzdl.zzc) { zzb = zzwi.zzb(new byte[0]); } else if (this.zza.zzf() == zzdl.zzb) { zzb = zzwi.zzb(ByteBuffer.allocate(5).put((byte) 0).putInt(this.zzd.intValue()).array()); } else { if (this.zza.zzf() != zzdl.zza) { throw new IllegalStateException("Unknown AesCtrHmacAeadParameters.Variant: ".concat(String.valueOf(this.zza.zzf()))); } zzb = zzwi.zzb(ByteBuffer.allocate(5).put((byte) 1).putInt(this.zzd.intValue()).array()); } return new zzde(this.zza, this.zzb, this.zzc, zzb, this.zzd, null); } private zzdc() { } }