org.jboss.security.srp
Class SRPRemoteServer

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by org.jboss.security.srp.SRPRemoteServer
All Implemented Interfaces:
Serializable, Remote, SRPRemoteServerInterface, SRPServerInterface

public class SRPRemoteServer
extends UnicastRemoteObject
implements SRPRemoteServerInterface

An implementation of the RMI SRPRemoteServerInterface interface.

Version:
$Revision: 57210 $
Author:
Scott.Stark@jboss.org
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
SRPRemoteServer(SRPVerifierStore verifierStore)
           
SRPRemoteServer(SRPVerifierStore verifierStore, int port)
           
SRPRemoteServer(SRPVerifierStore verifierStore, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf)
           
 
Method Summary
 void addSRPServerListener(SRPServerListener listener)
           
 void close(String username)
          Close the SRP session for the given username.
 void close(String username, int sessionID)
           
 boolean getRequireAuxChallenge()
           
 SRPParameters getSRPParameters(String username)
          The start of a new client session.
 Object[] getSRPParameters(String username, boolean multipleSessions)
          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.
 void removeSRPServerListener(SRPServerListener listener)
           
 void setRequireAuxChallenge(boolean flag)
           
 void setVerifierStore(SRPVerifierStore verifierStore)
           
 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.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SRPRemoteServer

public SRPRemoteServer(SRPVerifierStore verifierStore)
                throws RemoteException
Throws:
RemoteException

SRPRemoteServer

public SRPRemoteServer(SRPVerifierStore verifierStore,
                       int port)
                throws RemoteException
Throws:
RemoteException

SRPRemoteServer

public SRPRemoteServer(SRPVerifierStore verifierStore,
                       int port,
                       RMIClientSocketFactory csf,
                       RMIServerSocketFactory ssf)
                throws RemoteException
Throws:
RemoteException
Method Detail

setVerifierStore

public void setVerifierStore(SRPVerifierStore verifierStore)

addSRPServerListener

public void addSRPServerListener(SRPServerListener listener)

removeSRPServerListener

public void removeSRPServerListener(SRPServerListener listener)

getRequireAuxChallenge

public boolean getRequireAuxChallenge()

setRequireAuxChallenge

public void setRequireAuxChallenge(boolean flag)

getSRPParameters

public SRPParameters getSRPParameters(String username)
                               throws KeyException,
                                      RemoteException
The start of a new client session.

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

getSRPParameters

public Object[] getSRPParameters(String username,
                                 boolean multipleSessions)
                          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)
            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

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)
              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,
                     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
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
Parameters:
username - - the user ID by which the client is known. This is repeated to simplify the server session management.
M1 - - the client hash of the session key; M1 = H(H(N) xor H(g) | H(U) | A | B | K)
auxChallenge - - an arbitrary addition data item that my be used as an additional challenge. One example usage would be to send a hardware generated token that was encrypted with the session private key for validation by the server.
Returns:
M2, the server hash of the client challenge; M2 = H(A | M1 | K)
Throws:
SecurityException - thrown if M1 cannot be verified by the server
RemoteException - thrown by remote implementations

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)
           throws SecurityException,
                  RemoteException
Close the SRP session for the given username.

Specified by:
close 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


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