ECJPAKECurve (Bouncy Castle Library 1.85 API Specification)
Date: 2026-07-12

org.bouncycastle.crypto.agreement.ecjpake

## Class ECJPAKECurve

- java.lang.Object
- - org.bouncycastle.crypto.agreement.ecjpake.ECJPAKECurve

-     public class ECJPAKECurve
      extends java.lang.Object

  A pre-computed elliptic curve over a prime field, in short-Weierstrass form for use during an EC J-PAKE exchange.

  In general, J-PAKE can use any elliptic curve or prime order group that is suitable for public key cryptography.

  See `ECJPAKECurves` for convenient standard curves.

  NIST publishes many curves with different forms and levels of security.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ECJPAKECurve(java.math.BigInteger q, java.math.BigInteger a, java.math.BigInteger b, java.math.BigInteger n, java.math.BigInteger h, java.math.BigInteger g_x, java.math.BigInteger g_y)` Constructs a new `ECJPAKECurve`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.math.BigInteger` | `getA()`
    `java.math.BigInteger` | `getB()`
    `ECCurve.AbstractFp` | `getCurve()`
    `ECPoint` | `getG()`
    `java.math.BigInteger` | `getH()`
    `java.math.BigInteger` | `getN()`
    `java.math.BigInteger` | `getQ()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ECJPAKECurve

          public ECJPAKECurve(java.math.BigInteger q,
                              java.math.BigInteger a,
                              java.math.BigInteger b,
                              java.math.BigInteger n,
                              java.math.BigInteger h,
                              java.math.BigInteger g_x,
                              java.math.BigInteger g_y)

      Constructs a new `ECJPAKECurve`.

      In general, you should use one of the pre-approved curves from `ECJPAKECurves`, rather than manually constructing one.

      The following basic checks are performed:

      - q must be prime
      - n must be prime
      - The curve must not be singular i.e. the discriminant is equal to 0 mod q
      - G must lie on the curve
      - n*h, the implied order of the curve, must be within the Hasse bound of the field size
      - a must be in [0, q-1]
      - b must be in [0, q-1]

      The prime checks are performed using `BigInteger.isProbablePrime(int)`, and are therefore subject to the same probability guarantees.

      These checks prevent trivial mistakes. However, due to the small uncertainties if p and q are not prime, advanced attacks are not prevented. Use it at your own risk.

      Throws:
        `java.lang.NullPointerException` - if any argument is null
        `java.lang.IllegalArgumentException` - if any of the above validations fail

  - ### Method Detail

    - #### getCurve

          public ECCurve.AbstractFp getCurve()

    - #### getG

          public ECPoint getG()

    - #### getA

          public java.math.BigInteger getA()

    - #### getB

          public java.math.BigInteger getB()

    - #### getN

          public java.math.BigInteger getN()

    - #### getH

          public java.math.BigInteger getH()

    - #### getQ

          public java.math.BigInteger getQ()