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

import java.math.BigInteger;
import java.security.GeneralSecurityException;
import java.security.InvalidAlgorithmParameterException;

/* JADX INFO: loaded from: classes2.dex */
public final class s72 {

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public static final BigInteger f16337g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public static final BigInteger f16338h;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public Integer f16339a = null;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public BigInteger f16340b = v72.f17532g;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public t72 f16341c = null;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public t72 f16342d = null;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public Integer f16343e = null;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public u72 f16344f = u72.f17121e;

    static {
        BigInteger bigIntegerValueOf = BigInteger.valueOf(2L);
        f16337g = bigIntegerValueOf;
        f16338h = bigIntegerValueOf.pow(256);
    }

    public final void a(int i10) {
        this.f16339a = Integer.valueOf(i10);
    }

    public final void b(int i10) throws GeneralSecurityException {
        if (i10 < 0) {
            throw new GeneralSecurityException(String.format("Invalid salt length in bytes %d; salt length must be positive", Integer.valueOf(i10)));
        }
        this.f16343e = Integer.valueOf(i10);
    }

    public final v72 c() throws GeneralSecurityException {
        Integer num = this.f16339a;
        if (num == null) {
            throw new GeneralSecurityException("key size is not set");
        }
        if (this.f16340b == null) {
            throw new GeneralSecurityException("publicExponent is not set");
        }
        if (this.f16341c == null) {
            throw new GeneralSecurityException("signature hash type is not set");
        }
        if (this.f16342d == null) {
            throw new GeneralSecurityException("mgf1 hash type is not set");
        }
        if (this.f16344f == null) {
            throw new GeneralSecurityException("variant is not set");
        }
        if (this.f16343e == null) {
            throw new GeneralSecurityException("salt length is not set");
        }
        if (num.intValue() < 2048) {
            throw new InvalidAlgorithmParameterException(String.format("Invalid key size in bytes %d; must be at least %d bits", this.f16339a, 2048));
        }
        if (this.f16341c != this.f16342d) {
            throw new GeneralSecurityException("MGF1 hash is different from signature hash");
        }
        BigInteger bigInteger = this.f16340b;
        int iCompareTo = bigInteger.compareTo(v72.f17532g);
        if (iCompareTo != 0) {
            if (iCompareTo < 0) {
                throw new InvalidAlgorithmParameterException("Public exponent must be at least 65537.");
            }
            if (bigInteger.mod(f16337g).equals(BigInteger.ZERO)) {
                throw new InvalidAlgorithmParameterException("Invalid public exponent");
            }
            if (bigInteger.compareTo(f16338h) > 0) {
                throw new InvalidAlgorithmParameterException("Public exponent cannot be larger than 2^256.");
            }
        }
        return new v72(this.f16339a.intValue(), this.f16340b, this.f16344f, this.f16341c, this.f16342d, this.f16343e.intValue());
    }
}
