package org.bouncycastle.crypto.params;

/* JADX INFO: loaded from: E:\ios\vf_dex\classes4.dex */
public class ECDomainParameters implements org.bouncycastle.math.ec.ECConstants {
    private final org.bouncycastle.math.ec.ECCurve g;
    private final byte[] h;
    private final org.bouncycastle.math.ec.ECPoint i;
    private final java.math.BigInteger j;
    private final java.math.BigInteger k;
    private java.math.BigInteger l;

    public ECDomainParameters(org.bouncycastle.asn1.x9.X9ECParameters x9ECParameters) {
        this(x9ECParameters.n(), x9ECParameters.o(), x9ECParameters.r(), x9ECParameters.p(), x9ECParameters.s());
    }

    static org.bouncycastle.math.ec.ECPoint h(org.bouncycastle.math.ec.ECCurve eCCurve, org.bouncycastle.math.ec.ECPoint eCPoint) {
        if (eCPoint == null) {
            throw new java.lang.NullPointerException("Point cannot be null");
        }
        org.bouncycastle.math.ec.ECPoint eCPointA = org.bouncycastle.math.ec.ECAlgorithms.k(eCCurve, eCPoint).A();
        if (eCPointA.u()) {
            throw new java.lang.IllegalArgumentException("Point at infinity");
        }
        if (eCPointA.w()) {
            return eCPointA;
        }
        throw new java.lang.IllegalArgumentException("Point not on curve");
    }

    public org.bouncycastle.math.ec.ECCurve a() {
        return this.g;
    }

    public org.bouncycastle.math.ec.ECPoint b() {
        return this.i;
    }

    public java.math.BigInteger c() {
        return this.k;
    }

    public synchronized java.math.BigInteger d() {
        try {
            if (this.l == null) {
                this.l = org.bouncycastle.util.BigIntegers.o(this.j, this.k);
            }
        } catch (java.lang.Throwable th) {
            throw th;
        }
        return this.l;
    }

    public java.math.BigInteger e() {
        return this.j;
    }

    public boolean equals(java.lang.Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof org.bouncycastle.crypto.params.ECDomainParameters)) {
            return false;
        }
        org.bouncycastle.crypto.params.ECDomainParameters eCDomainParameters = (org.bouncycastle.crypto.params.ECDomainParameters) obj;
        return this.g.m(eCDomainParameters.g) && this.i.e(eCDomainParameters.i) && this.j.equals(eCDomainParameters.j);
    }

    public byte[] f() {
        return org.bouncycastle.util.Arrays.j(this.h);
    }

    public java.math.BigInteger g(java.math.BigInteger bigInteger) {
        if (bigInteger == null) {
            throw new java.lang.NullPointerException("Scalar cannot be null");
        }
        if (bigInteger.compareTo(org.bouncycastle.math.ec.ECConstants.b) < 0 || bigInteger.compareTo(e()) >= 0) {
            throw new java.lang.IllegalArgumentException("Scalar is not in the interval [1, n - 1]");
        }
        return bigInteger;
    }

    public int hashCode() {
        return this.j.hashCode() ^ ((((this.g.hashCode() ^ 1028) * 257) ^ this.i.hashCode()) * 257);
    }

    public org.bouncycastle.math.ec.ECPoint i(org.bouncycastle.math.ec.ECPoint eCPoint) {
        return h(a(), eCPoint);
    }

    public ECDomainParameters(org.bouncycastle.math.ec.ECCurve eCCurve, org.bouncycastle.math.ec.ECPoint eCPoint, java.math.BigInteger bigInteger) {
        this(eCCurve, eCPoint, bigInteger, org.bouncycastle.math.ec.ECConstants.b, null);
    }

    public ECDomainParameters(org.bouncycastle.math.ec.ECCurve eCCurve, org.bouncycastle.math.ec.ECPoint eCPoint, java.math.BigInteger bigInteger, java.math.BigInteger bigInteger2) {
        this(eCCurve, eCPoint, bigInteger, bigInteger2, null);
    }

    public ECDomainParameters(org.bouncycastle.math.ec.ECCurve eCCurve, org.bouncycastle.math.ec.ECPoint eCPoint, java.math.BigInteger bigInteger, java.math.BigInteger bigInteger2, byte[] bArr) {
        this.l = null;
        if (eCCurve == null) {
            throw new java.lang.NullPointerException("curve");
        }
        if (bigInteger == null) {
            throw new java.lang.NullPointerException("n");
        }
        this.g = eCCurve;
        this.i = h(eCCurve, eCPoint);
        this.j = bigInteger;
        this.k = bigInteger2;
        this.h = org.bouncycastle.util.Arrays.j(bArr);
    }
}
