|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--core.Protocol
Any extension of this abstract class represents a security protocol from the viewpoint of one of its agents. For example, to implement a Protocol with n agents, we need n classes extending Protocol.
Field Summary | |
private java.util.Vector |
agents
This vector represents all the Agent with whom this Protocol communicates |
protected Message |
m0
This message is used to manipulate the fields of a Message |
private static java.lang.Class |
messageC
|
private static java.lang.Class |
messageKeyC
|
private java.security.KeyStore |
myKeyStore
The KeyStore in which all public/private keys are stored |
private static java.lang.Class |
nonceC
|
protected java.util.Vector |
nonces
This vector contains the nonces that this Protocol knows |
private java.util.Stack |
parts
This stack is used to store the different fields of a given message |
private char[] |
password
This is the password to use to access the KeyStore |
private SecretKeyStore |
secretKeyStore
The SecretKeyStore in which all secret/shared keys are stored |
private java.util.Stack |
stackM0
This stack is used to restore a previous state during the protocol run |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
Protocol(java.lang.String m,
java.lang.String mk,
java.lang.String n)
Creates a new instance of Protocol |
Method Summary | |
protected void |
addAgent(Agent agent)
This method adds an agent to the list of known agents |
protected void |
addNonce(INonce nonce)
This method adds a nonce to the list of known nonces |
protected void |
addParts(IMessage[] array,
int size)
This method adds the given Messages into the list of Messages to be treated |
protected Agent |
agentFromId(java.lang.String id)
get Agent from id |
protected void |
checkTag(Message mm,
java.lang.String s)
|
void |
createNewNonce(java.lang.String id)
This method creates a new Nonce |
java.lang.String |
get(java.lang.String id)
Waits for a message from the given agent and returns it. |
java.util.Vector |
getAgents()
This method returns the Vector of Agents |
abstract java.lang.String[] |
getArgs(java.lang.String[] args)
This method has to be implemented by classes extending the Protocol class. |
protected Message |
getPart()
This method returns the next field to be treated |
java.security.PrivateKey |
getPrivateKey(java.lang.String agent)
This method returns the Private Key of a given agent by looking after it in the KeyStore |
java.security.PublicKey |
getPublicKey(java.lang.String agent)
This method returns the Public Key of a given agent by looking after it in the KeyStore |
java.security.Key |
getSecretKey(java.lang.String id)
This method returns the Secret Key of a given agent by looking after it in the SecretKeyStore |
protected java.lang.String |
IPFromId(java.lang.String id)
This method returns the IP of the agent whose id is given |
protected Message |
message()
|
protected Message |
message(Agent agent)
|
protected Message |
message(INonce n)
|
protected Message |
message(Message m1,
Message m2)
|
protected Message |
message(java.lang.String s)
|
protected IMessageKey |
messageKey()
|
protected IMessageKey |
messageKey(java.security.Key key)
|
protected IMessageKey |
messageKey(Message msg)
|
protected IMessageKey |
messageKey(java.lang.String algo)
|
protected java.lang.String |
nameFromId(java.lang.String id)
This method returns the name of the agent whose id is given |
void |
newAgent(java.lang.String id,
int port)
Waits for a connection to be established. |
protected INonce |
nonce()
|
protected INonce |
nonce(java.lang.Integer i)
|
protected INonce |
nonce(java.lang.String s)
|
INonce |
nonceFromId(java.lang.String id)
This method returns the Nonce whose id is given |
void |
put(java.lang.String id,
java.lang.String what)
Sends a message to another agent |
void |
put(java.lang.String id,
java.lang.String what,
int port)
Sends a message to another agent using the specified port |
protected Message |
restoreM0()
This method restore the last value of Message m0 |
abstract void |
run()
This method has to be implemented by classes extending the Protocol class. |
void |
setIPToId(java.lang.String ip,
java.lang.String id)
This method sets the IP of a given Agent |
protected void |
setKS(java.lang.String fileKeyStore,
java.lang.String password)
this method sets the KeyStore that has to be used |
void |
setNameToId(java.lang.String name,
java.lang.String id)
This method sets the name of a given Agent |
protected void |
setSKS(java.lang.String file)
this method sets the SecretKeyStore that has to be used |
void |
setValueToNonce(java.lang.String value,
java.lang.String id)
This method sets the value of a given Nonce |
protected void |
storeM0()
This method saves the current value of Message m0 |
java.lang.String |
valueFromNonce(java.lang.String id)
This method returns the value of a given Nonce |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private SecretKeyStore secretKeyStore
private java.security.KeyStore myKeyStore
private java.util.Vector agents
private char[] password
protected java.util.Vector nonces
private java.util.Stack parts
private java.util.Stack stackM0
protected Message m0
private static java.lang.Class messageC
private static java.lang.Class messageKeyC
private static java.lang.Class nonceC
Constructor Detail |
public Protocol(java.lang.String m, java.lang.String mk, java.lang.String n)
Method Detail |
protected Message message()
protected Message message(java.lang.String s)
protected Message message(Message m1, Message m2)
protected Message message(Agent agent)
protected Message message(INonce n)
protected INonce nonce()
protected INonce nonce(java.lang.Integer i)
protected INonce nonce(java.lang.String s)
protected IMessageKey messageKey()
protected IMessageKey messageKey(java.lang.String algo)
protected IMessageKey messageKey(java.security.Key key)
protected IMessageKey messageKey(Message msg)
protected void checkTag(Message mm, java.lang.String s) throws java.lang.Exception
java.lang.Exception
protected void storeM0()
protected Message restoreM0()
protected Message getPart()
protected void addAgent(Agent agent)
agent
- agent to add to the list of known agentsprotected void addNonce(INonce nonce)
nonce
- nonce to add to the list of known noncesprotected void setSKS(java.lang.String file)
file
- the SecretKeyStore that has to be usedprotected void setKS(java.lang.String fileKeyStore, java.lang.String password)
fileKeyStore
- the KeyStore that has to be usedpassword
- password to use to access this KeyStoreprotected void addParts(IMessage[] array, int size) throws java.lang.Exception
array
- array of messages that will have to be treatedsize
- expected size of the array
java.lang.Exception
- if the Message does not have the expected number of fieldspublic java.security.PrivateKey getPrivateKey(java.lang.String agent)
agent
- the agent whose key we are looking for
public java.security.PublicKey getPublicKey(java.lang.String agent)
agent
- the agent whose key we are looking for
public java.security.Key getSecretKey(java.lang.String id) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
protected Agent agentFromId(java.lang.String id)
id
- id of the agent to find
public INonce nonceFromId(java.lang.String id)
id
- id of the Nonce we are looking for
protected java.lang.String nameFromId(java.lang.String id) throws java.lang.Exception
id
- id of the agent whose name we are looking for
java.lang.Exception
protected java.lang.String IPFromId(java.lang.String id) throws java.lang.Exception
id
- id of the agent whose name we are looking for
java.lang.Exception
public java.lang.String get(java.lang.String id)
id
- id of the agent from which to get a message
public void newAgent(java.lang.String id, int port)
id
- id to assign to the new hostport
- port on which we are waiting for a connectionpublic void put(java.lang.String id, java.lang.String what)
what
- the message to sendpublic void put(java.lang.String id, java.lang.String what, int port)
what
- the message to sendport
- port to use to send the messagepublic void setNameToId(java.lang.String name, java.lang.String id) throws java.lang.Exception
name
- name to give to the Agentid
- id of the Agent
java.lang.Exception
- if the name of this Agent has already been set to something elsepublic void setIPToId(java.lang.String ip, java.lang.String id)
ip
- IP to give to the Agentid
- id of the Agentpublic void setValueToNonce(java.lang.String value, java.lang.String id) throws java.lang.Exception
value
- value to give to the Nonceid
- id of the Nonce
java.lang.Exception
- if the value of this Nonce has already been set to something elsepublic void createNewNonce(java.lang.String id)
id
- id of the new Nonce to createpublic java.lang.String valueFromNonce(java.lang.String id)
id
- id of the Nonce whose value we are looking for
public abstract void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public abstract java.lang.String[] getArgs(java.lang.String[] args)
public java.util.Vector getAgents()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |