Top Description Fields Constructors Methods
org.bouncycastle.crypto.agreement.ecjpake

public Class ECJPAKECurve

extends Object
Class Inheritance
Imports
java.math.BigInteger, org.bouncycastle.math.ec.ECCurve, .ECPoint

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.

Field Summary

Modifier and TypeField and Description
private final ECCurve.Fp
private final ECPoint
g

Constructor Summary

AccessConstructor and Description
public
pack-priv
ECJPAKECurve(ECCurve.Fp curve, ECPoint g)

Internal package-private constructor used by the pre-approved groups in ECJPAKECurves.

Method Summary

Modifier and TypeMethod and Description
private static BigInteger
public BigInteger
getA()

public BigInteger
getB()

public ECCurve.Fp
public ECPoint
getG()

public BigInteger
getH()

public BigInteger
getN()

public BigInteger
getQ()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

curveback to summary
private final ECCurve.Fp curve
gback to summary
private final ECPoint g

Constructor Detail

ECJPAKECurveback to summary
public ECJPAKECurve(BigInteger q, BigInteger a, BigInteger b, BigInteger n, BigInteger h, BigInteger g_x, 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 must equal the order of the curve
  • 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.

Exceptions
NullPointerException:
if any argument is null
IllegalArgumentException:
if any of the above validations fail
ECJPAKECurveback to summary
pack-priv ECJPAKECurve(ECCurve.Fp curve, ECPoint g)

Internal package-private constructor used by the pre-approved groups in ECJPAKECurves. These pre-approved curves can avoid the expensive checks.

Method Detail

calculateDeterminantback to summary
private static BigInteger calculateDeterminant(BigInteger q, BigInteger a, BigInteger b)
getAback to summary
public BigInteger getA()
getBback to summary
public BigInteger getB()
getCurveback to summary
public ECCurve.Fp getCurve()
getGback to summary
public ECPoint getG()
getHback to summary
public BigInteger getH()
getNback to summary
public BigInteger getN()
getQback to summary
public BigInteger getQ()