package com.google.android.gms.internal.p002firebaseauthapi; import java.security.GeneralSecurityException; import java.security.InvalidAlgorithmParameterException; /* loaded from: classes.dex */ public final class zzdj { private Integer zza; private Integer zzb; private Integer zzc; private Integer zzd; private zzdk zze; private zzdl zzf; /* synthetic */ zzdj(zzdi zzdiVar) { this.zza = null; this.zzb = null; this.zzc = null; this.zzd = null; this.zze = null; this.zzf = zzdl.zzc; } public final zzdj zza(int i10) { if (i10 != 16 && i10 != 24 && i10 != 32) { throw new InvalidAlgorithmParameterException(String.format("Invalid key size %d; only 16-byte, 24-byte and 32-byte AES keys are supported", Integer.valueOf(i10))); } this.zza = Integer.valueOf(i10); return this; } public final zzdj zzb(zzdk zzdkVar) { this.zze = zzdkVar; return this; } public final zzdj zzc(int i10) { if (i10 < 16) { throw new InvalidAlgorithmParameterException(String.format("Invalid key size in bytes %d; HMAC key must be at least 16 bytes", Integer.valueOf(i10))); } this.zzb = Integer.valueOf(i10); return this; } public final zzdj zzd(int i10) { if (i10 < 12 || i10 > 16) { throw new GeneralSecurityException(String.format("Invalid IV size in bytes %d; IV size must be between 12 and 16 bytes", Integer.valueOf(i10))); } this.zzc = Integer.valueOf(i10); return this; } public final zzdj zze(int i10) { if (i10 < 10) { throw new GeneralSecurityException(String.format("Invalid tag size in bytes %d; must be at least 10 bytes", Integer.valueOf(i10))); } this.zzd = Integer.valueOf(i10); return this; } public final zzdj zzf(zzdl zzdlVar) { this.zzf = zzdlVar; return this; } public final zzdn zzg() { if (this.zza == null) { throw new GeneralSecurityException("AES key size is not set"); } if (this.zzb == null) { throw new GeneralSecurityException("HMAC key size is not set"); } if (this.zzc == null) { throw new GeneralSecurityException("iv size is not set"); } Integer num = this.zzd; if (num == null) { throw new GeneralSecurityException("tag size is not set"); } if (this.zze == null) { throw new GeneralSecurityException("hash type is not set"); } if (this.zzf == null) { throw new GeneralSecurityException("variant is not set"); } int intValue = num.intValue(); zzdk zzdkVar = this.zze; if (zzdkVar == zzdk.zza) { if (intValue > 20) { throw new GeneralSecurityException(String.format("Invalid tag size in bytes %d; can be at most 20 bytes for SHA1", Integer.valueOf(intValue))); } } else if (zzdkVar == zzdk.zzb) { if (intValue > 28) { throw new GeneralSecurityException(String.format("Invalid tag size in bytes %d; can be at most 28 bytes for SHA224", Integer.valueOf(intValue))); } } else if (zzdkVar == zzdk.zzc) { if (intValue > 32) { throw new GeneralSecurityException(String.format("Invalid tag size in bytes %d; can be at most 32 bytes for SHA256", Integer.valueOf(intValue))); } } else if (zzdkVar == zzdk.zzd) { if (intValue > 48) { throw new GeneralSecurityException(String.format("Invalid tag size in bytes %d; can be at most 48 bytes for SHA384", Integer.valueOf(intValue))); } } else { if (zzdkVar != zzdk.zze) { throw new GeneralSecurityException("unknown hash type; must be SHA1, SHA224, SHA256, SHA384 or SHA512"); } if (intValue > 64) { throw new GeneralSecurityException(String.format("Invalid tag size in bytes %d; can be at most 64 bytes for SHA512", Integer.valueOf(intValue))); } } return new zzdn(this.zza.intValue(), this.zzb.intValue(), this.zzc.intValue(), this.zzd.intValue(), this.zzf, this.zze, null); } private zzdj() { this.zza = null; this.zzb = null; this.zzc = null; this.zzd = null; this.zze = null; throw null; } }