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 j72 {

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

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

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public BigInteger f12758b = m72.f13996e;

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public l72 f12760d = l72.f13522e;

    static {
        BigInteger bigIntegerValueOf = BigInteger.valueOf(2L);
        f12755e = bigIntegerValueOf;
        f12756f = bigIntegerValueOf.pow(256);
    }

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

    public final m72 b() throws GeneralSecurityException {
        Integer num = this.f12757a;
        if (num == null) {
            throw new GeneralSecurityException("key size is not set");
        }
        if (this.f12758b == null) {
            throw new GeneralSecurityException("publicExponent is not set");
        }
        if (this.f12759c == null) {
            throw new GeneralSecurityException("hash type is not set");
        }
        if (this.f12760d == null) {
            throw new GeneralSecurityException("variant is not set");
        }
        if (num.intValue() < 2048) {
            throw new InvalidAlgorithmParameterException(String.format("Invalid key size in bytes %d; must be at least 2048 bits", this.f12757a));
        }
        BigInteger bigInteger = this.f12758b;
        int iCompareTo = bigInteger.compareTo(m72.f13996e);
        if (iCompareTo != 0) {
            if (iCompareTo < 0) {
                throw new InvalidAlgorithmParameterException("Public exponent must be at least 65537.");
            }
            if (bigInteger.mod(f12755e).equals(BigInteger.ZERO)) {
                throw new InvalidAlgorithmParameterException("Invalid public exponent");
            }
            if (bigInteger.compareTo(f12756f) > 0) {
                throw new InvalidAlgorithmParameterException("Public exponent cannot be larger than 2^256.");
            }
        }
        return new m72(this.f12757a.intValue(), this.f12758b, this.f12760d, this.f12759c);
    }
}
