package org.bouncycastle.crypto.params;

/* JADX INFO: loaded from: E:\ios\vf_dex\classes4.dex */
public class DHParameters implements org.bouncycastle.crypto.CipherParameters {
    private java.math.BigInteger a;
    private java.math.BigInteger b;
    private java.math.BigInteger c;
    private java.math.BigInteger d;
    private int e;
    private int f;
    private org.bouncycastle.crypto.params.DHValidationParameters g;

    public DHParameters(java.math.BigInteger bigInteger, java.math.BigInteger bigInteger2) {
        this(bigInteger, bigInteger2, null, 0);
    }

    private static int a(int i) {
        if (i != 0 && i < 160) {
            return i;
        }
        return 160;
    }

    public java.math.BigInteger b() {
        return this.a;
    }

    public java.math.BigInteger c() {
        return this.d;
    }

    public int d() {
        return this.f;
    }

    public int e() {
        return this.e;
    }

    public boolean equals(java.lang.Object obj) {
        if (!(obj instanceof org.bouncycastle.crypto.params.DHParameters)) {
            return false;
        }
        org.bouncycastle.crypto.params.DHParameters dHParameters = (org.bouncycastle.crypto.params.DHParameters) obj;
        if (g() != null) {
            if (!g().equals(dHParameters.g())) {
                return false;
            }
        } else if (dHParameters.g() != null) {
            return false;
        }
        return dHParameters.f().equals(this.b) && dHParameters.b().equals(this.a);
    }

    public java.math.BigInteger f() {
        return this.b;
    }

    public java.math.BigInteger g() {
        return this.c;
    }

    public org.bouncycastle.crypto.params.DHValidationParameters h() {
        return this.g;
    }

    public int hashCode() {
        return (g() != null ? g().hashCode() : 0) ^ (f().hashCode() ^ b().hashCode());
    }

    public DHParameters(java.math.BigInteger bigInteger, java.math.BigInteger bigInteger2, java.math.BigInteger bigInteger3, int i) {
        this(bigInteger, bigInteger2, bigInteger3, a(i), i, null, null);
    }

    public DHParameters(java.math.BigInteger bigInteger, java.math.BigInteger bigInteger2, java.math.BigInteger bigInteger3, int i, int i2, java.math.BigInteger bigInteger4, org.bouncycastle.crypto.params.DHValidationParameters dHValidationParameters) {
        if (i2 != 0) {
            if (i2 > bigInteger.bitLength()) {
                throw new java.lang.IllegalArgumentException("when l value specified, it must satisfy 2^(l-1) <= p");
            }
            if (i2 < i) {
                throw new java.lang.IllegalArgumentException("when l value specified, it may not be less than m value");
            }
        }
        if (i > bigInteger.bitLength() && !org.bouncycastle.util.Properties.d("org.bouncycastle.dh.allow_unsafe_p_value")) {
            throw new java.lang.IllegalArgumentException("unsafe p value so small specific l required");
        }
        this.a = bigInteger2;
        this.b = bigInteger;
        this.c = bigInteger3;
        this.e = i;
        this.f = i2;
        this.d = bigInteger4;
        this.g = dHValidationParameters;
    }

    public DHParameters(java.math.BigInteger bigInteger, java.math.BigInteger bigInteger2, java.math.BigInteger bigInteger3, java.math.BigInteger bigInteger4, org.bouncycastle.crypto.params.DHValidationParameters dHValidationParameters) {
        this(bigInteger, bigInteger2, bigInteger3, 160, 0, bigInteger4, dHValidationParameters);
    }
}
