public class SRP6CryptoParams extends Object implements Serializable
The practical approach is to have the server manage these and make them available to clients on request. This way, the client does not need to anticipate or otherwise keep track of which parameters are used for which users or servers; it only needs to verify their validity, which can be done mathematically or by simple table lookup.
For convenience this class includes a set of precomputed parameters.
Modifier and Type | Field and Description |
---|---|
BigInteger |
g
The corresponding generator 'g'.
|
static BigInteger |
g_common
|
String |
H
The hash algorithm 'H'.
|
BigInteger |
N
The safe prime 'N'.
|
static BigInteger |
N_1024
Precomputed safe 1024-bit prime 'N', as decimal.
|
static BigInteger |
N_1536
Precomputed safe 1536-bit prime 'N', as decimal.
|
static BigInteger |
N_2048
Precomputed safe 2048-bit prime 'N', as decimal.
|
static BigInteger |
N_256
Precomputed safe 256-bit prime 'N', as decimal.
|
static BigInteger |
N_512
Precomputed safe 512-bit prime 'N', as decimal.
|
static BigInteger |
N_768
Precomputed safe 768-bit prime 'N', as decimal.
|
Constructor and Description |
---|
SRP6CryptoParams(BigInteger N,
BigInteger g,
String H)
Creates a new SRP-6a crypto parameters instance.
|
Modifier and Type | Method and Description |
---|---|
static SRP6CryptoParams |
getInstance()
Returns an SRP-6a crypto parameters instance with precomputed
512-bit prime 'N', matching 'g' value and "SHA-1" hash algorithm.
|
static SRP6CryptoParams |
getInstance(int bitsize,
String H)
Returns an SRP-6a crypto parameters instance with precomputed 'N'
and 'g' values and the specified hash algorithm 'H'.
|
MessageDigest |
getMessageDigestInstance()
Returns a new message digest instance for the hash algorithm 'H'.
|
static boolean |
isSupportedHashAlgorithm(String H)
Checks if the specified hash algorithm 'H' is supported by the
default security provider of the underlying Java runtime.
|
public static final BigInteger N_256
public static final BigInteger N_512
public static final BigInteger N_768
public static final BigInteger N_1024
public static final BigInteger N_1536
public static final BigInteger N_2048
public static final BigInteger g_common
public final BigInteger N
public final BigInteger g
public SRP6CryptoParams(BigInteger N, BigInteger g, String H)
N
- A large safe prime for the 'N' parameter. Must not be
null
.g
- A corresponding generator for the 'g' parameter. Must not be
null
.H
- A hash algorithm. Must by supported by the default security
provider of the underlying Java runtime. Must not be
null
.public static SRP6CryptoParams getInstance(int bitsize, String H)
bitsize
- The preferred prime number bitsize. Must exist as a
precomputed constant.H
- The preferred hash algorithm. Must be supported by the
default security provider of the underlying Java
runtime.null
if no matching constants or hash algorithm
provider could be found.public static SRP6CryptoParams getInstance()
public static boolean isSupportedHashAlgorithm(String H)
H
- The hash algorithm to check, e.g. "SHA-1".true
if the hash algorightm is supported, else
false
.public MessageDigest getMessageDigestInstance()
null
if not
supported by the default security provider of the underlying
Java runtime.Copyright © 2016 Connect2id Ltd.. All Rights Reserved.