public class SRP6Client
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.math.BigInteger |
a |
protected java.math.BigInteger |
A |
protected java.math.BigInteger |
B |
protected TlsHash |
digest |
protected java.math.BigInteger |
g |
protected java.math.BigInteger |
Key |
protected java.math.BigInteger |
M1 |
protected java.math.BigInteger |
M2 |
protected java.math.BigInteger |
N |
protected java.security.SecureRandom |
random |
protected java.math.BigInteger |
S |
protected java.math.BigInteger |
u |
protected java.math.BigInteger |
x |
Constructor and Description |
---|
SRP6Client() |
Modifier and Type | Method and Description |
---|---|
java.math.BigInteger |
calculateClientEvidenceMessage()
Computes the client evidence message M1 using the previously received values.
|
java.math.BigInteger |
calculateSecret(java.math.BigInteger serverB)
Generates the secret S given the server's credentials
|
java.math.BigInteger |
calculateSessionKey()
Computes the final session key as a result of the SRP successful mutual authentication
To be called after verifying the server evidence message M2.
|
java.math.BigInteger |
generateClientCredentials(byte[] salt,
byte[] identity,
byte[] password)
Generates client's credentials given the client's salt, identity and password
|
void |
init(java.math.BigInteger N,
java.math.BigInteger g,
TlsHash digest,
java.security.SecureRandom random)
Initialises the client to begin new authentication attempt
|
void |
init(SRP6Group group,
TlsHash digest,
java.security.SecureRandom random) |
protected java.math.BigInteger |
selectPrivateValue() |
boolean |
verifyServerEvidenceMessage(java.math.BigInteger serverM2)
Authenticates the server evidence message M2 received and saves it only if correct.
|
protected java.math.BigInteger N
protected java.math.BigInteger g
protected java.math.BigInteger a
protected java.math.BigInteger A
protected java.math.BigInteger B
protected java.math.BigInteger x
protected java.math.BigInteger u
protected java.math.BigInteger S
protected java.math.BigInteger M1
protected java.math.BigInteger M2
protected java.math.BigInteger Key
protected TlsHash digest
protected java.security.SecureRandom random
public void init(java.math.BigInteger N, java.math.BigInteger g, TlsHash digest, java.security.SecureRandom random)
N
- The safe prime associated with the client's verifierg
- The group parameter associated with the client's verifierdigest
- The digest algorithm associated with the client's verifierrandom
- For key generationpublic java.math.BigInteger generateClientCredentials(byte[] salt, byte[] identity, byte[] password)
salt
- The salt used in the client's verifier.identity
- The user's identity (eg. username)password
- The user's passwordpublic java.math.BigInteger calculateSecret(java.math.BigInteger serverB)
serverB
- The server's credentialsjava.lang.IllegalArgumentException
- If server's credentials are invalidprotected java.math.BigInteger selectPrivateValue()
public java.math.BigInteger calculateClientEvidenceMessage() throws java.lang.IllegalStateException
java.lang.IllegalStateException
public boolean verifyServerEvidenceMessage(java.math.BigInteger serverM2) throws java.lang.IllegalStateException
serverM2
- the server side generated evidence messagejava.lang.IllegalStateException
public java.math.BigInteger calculateSessionKey() throws java.lang.IllegalStateException
java.lang.IllegalStateException