package ea;

import java.security.GeneralSecurityException;

/* JADX INFO: loaded from: classes2.dex */
public final class z extends b {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final c0 f25794b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final xyz.stream.utils.f0 f25795c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final ta.a f25796d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final Integer f25797e;

    public z(c0 c0Var, xyz.stream.utils.f0 f0Var, ta.a aVar, Integer num) {
        this.f25794b = c0Var;
        this.f25795c = f0Var;
        this.f25796d = aVar;
        this.f25797e = num;
    }

    public static z S(b0 b0Var, xyz.stream.utils.f0 f0Var, Integer num) throws GeneralSecurityException {
        ta.a aVarB;
        b0 b0Var2 = b0.f25632d;
        if (b0Var != b0Var2 && num == null) {
            throw new GeneralSecurityException("For given Variant " + b0Var + " the value of idRequirement must be non-null");
        }
        if (b0Var == b0Var2 && num != null) {
            throw new GeneralSecurityException("For given Variant NO_PREFIX the value of idRequirement must be null");
        }
        if (f0Var.E() != 32) {
            throw new GeneralSecurityException("ChaCha20Poly1305 key must be constructed with key of length 32 bytes, not " + f0Var.E());
        }
        c0 c0Var = new c0(b0Var);
        if (b0Var == b0Var2) {
            aVarB = ma.u.f30557a;
        } else if (b0Var == b0.f25631c) {
            aVarB = ma.u.a(num.intValue());
        } else {
            if (b0Var != b0.f25630b) {
                throw new IllegalStateException("Unknown Variant: " + b0Var);
            }
            aVarB = ma.u.b(num.intValue());
        }
        return new z(c0Var, f0Var, aVarB, num);
    }

    @Override // ea.b
    public final ta.a R() {
        return this.f25796d;
    }

    @Override // com.bumptech.glide.g
    public final Integer i() {
        return this.f25797e;
    }

    @Override // com.bumptech.glide.g
    public final da.l j() {
        return this.f25794b;
    }
}
