Class SRP6Server
java.lang.Object
org.bouncycastle.crypto.agreement.srp.SRP6Server
Implements the server side SRP-6a protocol. Note that this class is stateful, and therefore NOT threadsafe.
This implementation of SRP is based on the optimized message sequence put forth by Thomas Wu in the paper
"SRP-6: Improvements and Refinements to the Secure Remote Password Protocol, 2002"
-
Field Summary
Modifier and TypeFieldDescriptionprotected BigInteger
protected BigInteger
protected BigInteger
protected Digest
protected BigInteger
protected BigInteger
protected BigInteger
protected BigInteger
protected BigInteger
protected SecureRandom
protected BigInteger
protected BigInteger
protected BigInteger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncalculateSecret
(BigInteger clientA) Processes the client's credentials.Computes the server evidence message M2 using the previously verified values.Computes the final session key as a result of the SRP successful mutual authentication To be called after calculating the server evidence message M2.Generates the server's credentials that are to be sent to the client.void
init
(BigInteger N, BigInteger g, BigInteger v, Digest digest, SecureRandom random) Initialises the server to accept a new client authentication attemptvoid
init
(SRP6GroupParameters group, BigInteger v, Digest digest, SecureRandom random) protected BigInteger
boolean
verifyClientEvidenceMessage
(BigInteger clientM1) Authenticates the received client evidence message M1 and saves it only if correct.
-
Field Details
-
N
-
g
-
v
-
random
-
digest
-
A
-
b
-
B
-
u
-
S
-
M1
-
M2
-
Key
-
-
Constructor Details
-
SRP6Server
public SRP6Server()
-
-
Method Details
-
init
Initialises the server to accept a new client authentication attempt- Parameters:
N
- The safe prime associated with the client's verifierg
- The group parameter associated with the client's verifierv
- The client's verifierdigest
- The digest algorithm associated with the client's verifierrandom
- For key generation
-
init
-
generateServerCredentials
Generates the server's credentials that are to be sent to the client.- Returns:
- The server's public value to the client
-
calculateSecret
Processes the client's credentials. If valid the shared secret is generated and returned.- Parameters:
clientA
- The client's credentials- Returns:
- A shared secret BigInteger
- Throws:
CryptoException
- If client's credentials are invalid
-
selectPrivateValue
-
verifyClientEvidenceMessage
Authenticates the received client evidence message M1 and saves it only if correct. To be called after calculating the secret S.- Parameters:
clientM1
- the client side generated evidence message- Returns:
- A boolean indicating if the client message M1 was the expected one.
- Throws:
CryptoException
-
calculateServerEvidenceMessage
Computes the server evidence message M2 using the previously verified values. To be called after successfully verifying the client evidence message M1.- Returns:
- M2: the server side generated evidence message
- Throws:
CryptoException
-
calculateSessionKey
Computes the final session key as a result of the SRP successful mutual authentication To be called after calculating the server evidence message M2.- Returns:
- Key: the mutual authenticated symmetric session key
- Throws:
CryptoException
-