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

public Class SRP6Server

extends Object
Class Inheritance
Imports
java.math.BigInteger, java.security.SecureRandom, org.bouncycastle.crypto.CryptoException, .Digest, org.bouncycastle.crypto.params.SRP6GroupParameters

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 TypeField and Description
protected BigInteger
A

protected BigInteger
b

protected BigInteger
B

protected Digest
protected BigInteger
g

protected BigInteger
protected BigInteger
protected BigInteger
protected BigInteger
N

protected SecureRandom
protected BigInteger
S

protected BigInteger
u

protected BigInteger
v

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private BigInteger
public BigInteger

Returns:

A shared secret BigInteger
calculateSecret
(BigInteger
The client's credentials
clientA
)

Processes the client's credentials.

public BigInteger

Returns:

M2: the server side generated evidence message
calculateServerEvidenceMessage
()

Computes the server evidence message M2 using the previously verified values.

public BigInteger

Returns:

Key: the mutual authenticated symmetric session key
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.

public BigInteger

Returns:

The server's public value to the client
generateServerCredentials
()

Generates the server's credentials that are to be sent to the client.

public void
init(BigInteger
The safe prime associated with the client's verifier
N
,
BigInteger
The group parameter associated with the client's verifier
g
,
BigInteger
The client's verifier
v
,
Digest
The digest algorithm associated with the client's verifier
digest
,
SecureRandom
For key generation
random
)

Initialises the server to accept a new client authentication attempt

public void
protected BigInteger
public boolean

Returns:

A boolean indicating if the client message M1 was the expected one.
verifyClientEvidenceMessage
(BigInteger
the client side generated evidence message
clientM1
)

Authenticates the received client evidence message M1 and saves it only if correct.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

Aback to summary
protected BigInteger A
bback to summary
protected BigInteger b
Bback to summary
protected BigInteger B
digestback to summary
protected Digest digest
gback to summary
protected BigInteger g
Keyback to summary
protected BigInteger Key
M1back to summary
protected BigInteger M1
M2back to summary
protected BigInteger M2
Nback to summary
protected BigInteger N
randomback to summary
protected SecureRandom random
Sback to summary
protected BigInteger S
uback to summary
protected BigInteger u
vback to summary
protected BigInteger v

Constructor Detail

SRP6Serverback to summary
public SRP6Server()

Method Detail

calculateSback to summary
private BigInteger calculateS()
calculateSecretback to summary
public BigInteger calculateSecret(BigInteger clientA) throws CryptoException

Processes the client's credentials. If valid the shared secret is generated and returned.

Parameters
clientA:BigInteger

The client's credentials

Returns:BigInteger

A shared secret BigInteger

Exceptions
CryptoException:
If client's credentials are invalid
calculateServerEvidenceMessageback to summary
public BigInteger calculateServerEvidenceMessage() throws CryptoException

Computes the server evidence message M2 using the previously verified values. To be called after successfully verifying the client evidence message M1.

Returns:BigInteger

M2: the server side generated evidence message

calculateSessionKeyback to summary
public BigInteger calculateSessionKey() throws CryptoException

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:BigInteger

Key: the mutual authenticated symmetric session key

generateServerCredentialsback to summary
public BigInteger generateServerCredentials()

Generates the server's credentials that are to be sent to the client.

Returns:BigInteger

The server's public value to the client

initback to summary
public void init(BigInteger N, BigInteger g, BigInteger v, Digest digest, SecureRandom random)

Initialises the server to accept a new client authentication attempt

Parameters
N:BigInteger

The safe prime associated with the client's verifier

g:BigInteger

The group parameter associated with the client's verifier

v:BigInteger

The client's verifier

digest:Digest

The digest algorithm associated with the client's verifier

random:SecureRandom

For key generation

initback to summary
public void init(SRP6GroupParameters group, BigInteger v, Digest digest, SecureRandom random)
selectPrivateValueback to summary
protected BigInteger selectPrivateValue()
verifyClientEvidenceMessageback to summary
public boolean verifyClientEvidenceMessage(BigInteger clientM1) throws CryptoException

Authenticates the received client evidence message M1 and saves it only if correct. To be called after calculating the secret S.

Parameters
clientM1:BigInteger

the client side generated evidence message

Returns:boolean

A boolean indicating if the client message M1 was the expected one.