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

public Class JPAKEPrimeOrderGroup

extends Object
Class Inheritance
Imports
java.math.BigInteger

A pre-computed prime order group for use during a J-PAKE exchange.

Typically a Schnorr group is used. In general, J-PAKE can use any prime order group that is suitable for public key cryptography, including elliptic curve cryptography.

See JPAKEPrimeOrderGroups for convenient standard groups.

NIST publishes many groups that can be used for the desired level of security.

Field Summary

Modifier and TypeField and Description
private final BigInteger
g

private final BigInteger
p

private final BigInteger
q

Constructor Summary

AccessConstructor and Description
public
pack-priv
JPAKEPrimeOrderGroup(BigInteger p, BigInteger q, BigInteger g, boolean skipChecks)

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

Method Summary

Modifier and TypeMethod and Description
public BigInteger
getG()

public BigInteger
getP()

public BigInteger
getQ()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

gback to summary
private final BigInteger g
pback to summary
private final BigInteger p
qback to summary
private final BigInteger q

Constructor Detail

JPAKEPrimeOrderGroupback to summary
public JPAKEPrimeOrderGroup(BigInteger p, BigInteger q, BigInteger g)

Constructs a new JPAKEPrimeOrderGroup.

In general, you should use one of the pre-approved groups from JPAKEPrimeOrderGroups, rather than manually constructing one.

The following basic checks are performed:

  • p-1 must be evenly divisible by q
  • g must be in [2, p-1]
  • g^q mod p must equal 1
  • p must be prime (within reasonably certainty)
  • q must be prime (within reasonably certainty)

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
JPAKEPrimeOrderGroupback to summary
pack-priv JPAKEPrimeOrderGroup(BigInteger p, BigInteger q, BigInteger g, boolean skipChecks)

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

Method Detail

getGback to summary
public BigInteger getG()
getPback to summary
public BigInteger getP()
getQback to summary
public BigInteger getQ()