org.jboss.test
Class SimpleSRPServer

java.lang.Object
  extended byorg.jboss.test.SimpleSRPServer
All Implemented Interfaces:
SRPServerInterface (src)

public class SimpleSRPServer
extends java.lang.Object
implements SRPServerInterface (src)

A simple hard coded implementation of SRPServerInterface that validates any given username to the password and salt provided to its constructor.


Method Summary
 void close(java.lang.String username)
          Close the SRP session for the given username.
 void close(java.lang.String username, int sessionID)
           
 SRPParameters (src) getSRPParameters(java.lang.String username)
          Get the SRP parameters to use for this session.
 java.lang.Object[] getSRPParameters(java.lang.String username, boolean mutipleSessions)
          Get the SRP parameters to use for this session and create an arbitrary session id to allow for multiple SRP sessions for this user.
 byte[] init(java.lang.String username, byte[] A)
          Initiate the SRP algorithm.
 byte[] init(java.lang.String username, byte[] A, int sessionID)
          Initiate the SRP algorithm.
 byte[] verify(java.lang.String username, byte[] M1)
          Verify the session key hash.
 byte[] verify(java.lang.String username, byte[] M1, int sessionID)
           
 byte[] verify(java.lang.String username, byte[] M1, java.lang.Object auxChallenge)
          Verify the session key hash.
 byte[] verify(java.lang.String username, byte[] M1, java.lang.Object auxChallenge, int sessionID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSRPParameters

public java.lang.Object[] getSRPParameters(java.lang.String username,
                                           boolean mutipleSessions)
                                    throws java.security.KeyException,
                                           java.rmi.RemoteException
Description copied from interface: SRPServerInterface (src)
Get the SRP parameters to use for this session and create an arbitrary session id to allow for multiple SRP sessions for this user.

Specified by:
getSRPParameters in interface SRPServerInterface (src)
Returns:
an array of {SRPParameters, Integer} where element[0] is the SRPParameters object and element[1] is the session id as an Integer.
Throws:
java.security.KeyException
java.rmi.RemoteException

init

public byte[] init(java.lang.String username,
                   byte[] A,
                   int sessionID)
            throws java.lang.SecurityException,
                   java.security.NoSuchAlgorithmException,
                   java.rmi.RemoteException
Description copied from interface: SRPServerInterface (src)
Initiate the SRP algorithm. The client sends their username and the public key A to begin the SRP handshake.

Specified by:
init in interface SRPServerInterface (src)
Returns:
byte[], ephemeral server public key B = (v + g ^ b) % N
Throws:
java.lang.SecurityException
java.security.NoSuchAlgorithmException
java.rmi.RemoteException

verify

public byte[] verify(java.lang.String username,
                     byte[] M1,
                     int sessionID)
              throws java.lang.SecurityException,
                     java.rmi.RemoteException
Specified by:
verify in interface SRPServerInterface (src)
Throws:
java.lang.SecurityException
java.rmi.RemoteException

verify

public byte[] verify(java.lang.String username,
                     byte[] M1,
                     java.lang.Object auxChallenge)
              throws java.lang.SecurityException,
                     java.rmi.RemoteException
Description copied from interface: SRPServerInterface (src)
Verify the session key hash. The client sends their username and M1 hash to validate completion of the SRP handshake.

Specified by:
verify in interface SRPServerInterface (src)
Returns:
M2, the server hash of the client challenge; M2 = H(A | M1 | K)
Throws:
java.lang.SecurityException
java.rmi.RemoteException

verify

public byte[] verify(java.lang.String username,
                     byte[] M1,
                     java.lang.Object auxChallenge,
                     int sessionID)
              throws java.lang.SecurityException,
                     java.rmi.RemoteException
Specified by:
verify in interface SRPServerInterface (src)
Throws:
java.lang.SecurityException
java.rmi.RemoteException

close

public void close(java.lang.String username,
                  int sessionID)
           throws java.lang.SecurityException,
                  java.rmi.RemoteException
Specified by:
close in interface SRPServerInterface (src)
Throws:
java.lang.SecurityException
java.rmi.RemoteException

getSRPParameters

public SRPParameters (src)  getSRPParameters(java.lang.String username)
                               throws java.security.KeyException,
                                      java.rmi.RemoteException
Description copied from interface: SRPServerInterface (src)
Get the SRP parameters to use for this session.

Specified by:
getSRPParameters in interface SRPServerInterface (src)
Returns:
the users SRPParameters object
Throws:
java.security.KeyException
java.rmi.RemoteException

init

public byte[] init(java.lang.String username,
                   byte[] A)
            throws java.lang.SecurityException,
                   java.security.NoSuchAlgorithmException,
                   java.rmi.RemoteException
Description copied from interface: SRPServerInterface (src)
Initiate the SRP algorithm. The client sends their username and the public key A to begin the SRP handshake.

Specified by:
init in interface SRPServerInterface (src)
Returns:
byte[], ephemeral server public key B = (v + g ^ b) % N
Throws:
java.lang.SecurityException
java.security.NoSuchAlgorithmException
java.rmi.RemoteException

verify

public byte[] verify(java.lang.String username,
                     byte[] M1)
              throws java.lang.SecurityException,
                     java.rmi.RemoteException
Description copied from interface: SRPServerInterface (src)
Verify the session key hash. The client sends their username and M1 hash to validate completion of the SRP handshake.

Specified by:
verify in interface SRPServerInterface (src)
Returns:
M2, the server hash of the client challenge; M2 = H(A | M1 | K)
Throws:
java.lang.SecurityException
java.rmi.RemoteException

close

public void close(java.lang.String username)
           throws java.lang.SecurityException,
                  java.rmi.RemoteException
Close the SRP session for the given username.

Specified by:
close in interface SRPServerInterface (src)
Throws:
java.lang.SecurityException
java.rmi.RemoteException