package com.google.android.gms.internal.ads;

import java.security.GeneralSecurityException;

/* JADX INFO: loaded from: classes2.dex */
public final class ly1 extends jw1 {

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final jc1 f13910c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final i92 f13911d;

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

    public ly1(py1 py1Var, jc1 jc1Var, i92 i92Var, Integer num) {
        this.f13909b = py1Var;
        this.f13910c = jc1Var;
        this.f13911d = i92Var;
        this.f13912e = num;
    }

    public static ly1 A(oy1 oy1Var, jc1 jc1Var, Integer num) throws GeneralSecurityException {
        i92 i92VarB;
        oy1 oy1Var2 = oy1.f15208d;
        if (oy1Var != oy1Var2 && num == null) {
            String str = oy1Var.f15209a;
            throw new GeneralSecurityException(defpackage.e.p(new StringBuilder(str.length() + 62), "For given Variant ", str, " the value of idRequirement must be non-null"));
        }
        if (oy1Var == oy1Var2 && num != null) {
            throw new GeneralSecurityException("For given Variant NO_PREFIX the value of idRequirement must be null");
        }
        if (jc1Var.i() != 32) {
            int i10 = jc1Var.i();
            throw new GeneralSecurityException(defpackage.e.n(new StringBuilder(String.valueOf(i10).length() + 75), "XChaCha20Poly1305 key must be constructed with key of length 32 bytes, not ", i10));
        }
        py1 py1Var = new py1(oy1Var);
        if (oy1Var == oy1Var2) {
            i92VarB = u02.f17053a;
        } else if (oy1Var == oy1.f15207c) {
            i92VarB = u02.a(num.intValue());
        } else {
            if (oy1Var != oy1.f15206b) {
                throw new IllegalStateException("Unknown Variant: ".concat(oy1Var.f15209a));
            }
            i92VarB = u02.b(num.intValue());
        }
        return new ly1(py1Var, jc1Var, i92VarB, num);
    }

    @Override // com.google.android.gms.internal.ads.rb
    public final /* synthetic */ dw1 i() {
        return this.f13909b;
    }

    @Override // com.google.android.gms.internal.ads.rb
    public final Integer r() {
        return this.f13912e;
    }

    @Override // com.google.android.gms.internal.ads.jw1
    public final i92 z() {
        return this.f13911d;
    }
}
