org.jboss.security.test
Class SimpleSRPServer

java.lang.Object
  extended by org.jboss.security.test.SimpleSRPServer
All Implemented Interfaces:
SRPServerInterface

public class SimpleSRPServer
extends Object
implements SRPServerInterface

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

Version:
$Revision: 57210 $
Author:
Scott.Stark@jboss.org

Method Summary
 void close(String username)
          Close the SRP session for the given username.
 void close(String username, int sessionID)
           
 SRPParameters getSRPParameters(String username)
          Get the SRP parameters to use for this session.
 Object[] getSRPParameters(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(String username, byte[] A)
          Initiate the SRP algorithm.
 byte[] init(String username, byte[] A, int sessionID)
          Initiate the SRP algorithm.
 byte[] verify(String username, byte[] M1)
          Verify the session key hash.
 byte[] verify(String username, byte[] M1, int sessionID)
           
 byte[] verify(String username, byte[] M1, Object auxChallenge)
          Verify the session key hash.
 byte[] verify(String username, byte[] M1, 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 Object[] getSRPParameters(String username,
                                 boolean mutipleSessions)
                          throws KeyException,
                                 RemoteException
Description copied from interface: SRPServerInterface
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
Returns:
an array of {SRPParameters, Integer} where element[0] is the SRPParameters object and element[1] is the session id as an Integer.
Throws:
KeyException
RemoteException

init

public byte[] init(String username,
                   byte[] A,
                   int sessionID)
            throws SecurityException,
                   NoSuchAlgorithmException,
                   RemoteException
Description copied from interface: SRPServerInterface
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
Returns:
byte[], ephemeral server public key B = (v + g ^ b) % N
Throws:
SecurityException
NoSuchAlgorithmException
RemoteException

verify

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

verify

public byte[] verify(String username,
                     byte[] M1,
                     Object auxChallenge)
              throws SecurityException,
                     RemoteException
Description copied from interface: SRPServerInterface
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
Returns:
M2, the server hash of the client challenge; M2 = H(A | M1 | K)
Throws:
SecurityException
RemoteException

verify

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

close

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

getSRPParameters

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

Specified by:
getSRPParameters in interface SRPServerInterface
Returns:
the users SRPParameters object
Throws:
KeyException
RemoteException

init

public byte[] init(String username,
                   byte[] A)
            throws SecurityException,
                   NoSuchAlgorithmException,
                   RemoteException
Description copied from interface: SRPServerInterface
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
Returns:
byte[], ephemeral server public key B = (v + g ^ b) % N
Throws:
SecurityException
NoSuchAlgorithmException
RemoteException

verify

public byte[] verify(String username,
                     byte[] M1)
              throws SecurityException,
                     RemoteException
Description copied from interface: SRPServerInterface
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
Returns:
M2, the server hash of the client challenge; M2 = H(A | M1 | K)
Throws:
SecurityException
RemoteException

close

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

Specified by:
close in interface SRPServerInterface
Throws:
SecurityException
RemoteException


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.