core
Class SecretKeyStore

java.lang.Object
  |
  +--core.SecretKeyStore

public class SecretKeyStore
extends java.lang.Object

This class represents a SecretKeyStore. It is equivalent to a KeyStore except that instead of storing Public and Secret Keys, it stores Secret Keys.

Author:
Xavier Didelot

Field Summary
private  java.lang.String file
          File in which the SecretKeyStore is located
 
Constructor Summary
SecretKeyStore(java.lang.String file)
          Creates a new SecretKeyStore
 
Method Summary
 void addKey(java.lang.String id, java.security.Key key)
          This method adds a given key to this SecretKeyStore
 java.security.Key getKey(java.lang.String id)
          This method returns the secret key of a given Agent
static void main(java.lang.String[] args)
          This sample method shows how to create a new SecretKeyStore.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

file

private java.lang.String file
File in which the SecretKeyStore is located

Constructor Detail

SecretKeyStore

public SecretKeyStore(java.lang.String file)
Creates a new SecretKeyStore

Parameters:
file - file in which the SecretKeyStore is located
Method Detail

getKey

public java.security.Key getKey(java.lang.String id)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException
This method returns the secret key of a given Agent

Parameters:
id - id of the Agent whose Secrey Key we are looking for
Returns:
the secret key of a given Agent
Throws:
java.io.IOException
java.lang.ClassNotFoundException

addKey

public void addKey(java.lang.String id,
                   java.security.Key key)
            throws java.io.FileNotFoundException,
                   java.io.IOException
This method adds a given key to this SecretKeyStore

Parameters:
id - id of the Agent whose key belongs to
key - key to store
Throws:
java.io.FileNotFoundException
java.io.IOException

main

public static void main(java.lang.String[] args)
This sample method shows how to create a new SecretKeyStore. Here we create a new SecretKeyStore containing a new DES key for agent a and a new DES key for Agent b.

Parameters:
args -