jason.client
Class KeyStore

java.lang.Object
  |
  +--jason.client.KeyStore
All Implemented Interfaces:
java.io.Serializable

public class KeyStore
extends java.lang.Object
implements java.io.Serializable

Title: Javacards As Secure Object Network

Description: KeyStore to be used on a client side computer

Copyright: Copyright (c) 2002

Company: University of Twente

See Also:
Serialized Form

Field Summary
protected static java.lang.String[] algorithmNames
          List of all supported algorithm names
protected static byte[] algorithmValues
          List of all supported algorithm types
protected  java.util.Hashtable freshnessCounters
           
protected  java.util.Hashtable keys
          Mapping between role byte and Key
protected  java.util.Hashtable sessionAlgorithms
          Mapping between role byte and the name of the corresponding session algorithm name
 
Constructor Summary
KeyStore()
          Initializes a new KeyStore.
 
Method Summary
static byte algorithmNameToValue(java.lang.String algorithmName)
          Mapping between algorithm names and its value
static java.lang.String algorithmValueToName(byte algorithmValue)
          Mapping between the value of an algorithm and it's name.
private static java.lang.String arrayToString(byte[] data)
           
 byte getAlgorithmValue(byte role)
          Gets the algorithm value of the key associated with the given role.
 byte getFreshnessCounter(byte role)
          Gets the freshness counter for the specified role.
 java.security.Key getKey(byte role)
          Gets the Key corresponding to the role.
 java.lang.String getSessionAlgorithmName(byte role)
          Gets the algorithm name of the session key that should be used when logging in as the specified role.
 byte getSessionAlgorithmValue(byte role)
          Gets the algorithm value of the session key that should be used when logging in as the specified role.
 void increaseFreshnessCounter(byte role)
          Increases the freshness counter for the specified role.
static KeyStore load(java.io.InputStream input)
          Loads the key store from an InputStream.
 void setKey(byte role, java.security.Key key, java.lang.String sessionAlgorithm)
          Sets a new key.
 void show()
          Shows the contents of the keystore.
 void store(java.io.OutputStream output)
          Stores the key store to an OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

algorithmNames

protected static final java.lang.String[] algorithmNames
List of all supported algorithm names


algorithmValues

protected static final byte[] algorithmValues
List of all supported algorithm types


keys

protected java.util.Hashtable keys
Mapping between role byte and Key


sessionAlgorithms

protected java.util.Hashtable sessionAlgorithms
Mapping between role byte and the name of the corresponding session algorithm name


freshnessCounters

protected java.util.Hashtable freshnessCounters
Constructor Detail

KeyStore

public KeyStore()
Initializes a new KeyStore.

Method Detail

getKey

public java.security.Key getKey(byte role)
Gets the Key corresponding to the role.

Parameters:
role - Role byte
Returns:
The corresponding Key

setKey

public void setKey(byte role,
                   java.security.Key key,
                   java.lang.String sessionAlgorithm)
Sets a new key.

Parameters:
role - Role byte
key - The key
sessionAlgorithm - The name of the algorithm used encrypting the whole session

algorithmNameToValue

public static byte algorithmNameToValue(java.lang.String algorithmName)
Mapping between algorithm names and its value

Parameters:
algorithmName - The name of the algorithm
Returns:
The value of the algorithm

algorithmValueToName

public static java.lang.String algorithmValueToName(byte algorithmValue)
Mapping between the value of an algorithm and it's name.

Parameters:
algorithmValue - The value of the algorithm
Returns:
The name of the algorithrm

getAlgorithmValue

public byte getAlgorithmValue(byte role)
Gets the algorithm value of the key associated with the given role.

Parameters:
role - The role byte
Returns:
The algorithm value

getSessionAlgorithmName

public java.lang.String getSessionAlgorithmName(byte role)
Gets the algorithm name of the session key that should be used when logging in as the specified role.

Parameters:
role - The role byte
Returns:
The session algorithm name

getSessionAlgorithmValue

public byte getSessionAlgorithmValue(byte role)
Gets the algorithm value of the session key that should be used when logging in as the specified role.

Parameters:
role - The role byte
Returns:
The session algorithm value

increaseFreshnessCounter

public void increaseFreshnessCounter(byte role)
Increases the freshness counter for the specified role. The freshness counter should be increased each time a signature is calculated.

Parameters:
role -

getFreshnessCounter

public byte getFreshnessCounter(byte role)
Gets the freshness counter for the specified role.

Parameters:
role - The role byte for which the freshness counter is requested
Returns:
The freshness counter

load

public static KeyStore load(java.io.InputStream input)
                     throws java.io.IOException
Loads the key store from an InputStream. The stream will be closed.

Parameters:
input - The inputstream
Returns:
A key store instance
Throws:
java.io.IOException - when the input stream cannot be read from

store

public void store(java.io.OutputStream output)
           throws java.io.IOException
Stores the key store to an OutputStream. The stream will be closed.

Parameters:
output - The outputstream
Throws:
java.io.IOException - when the output stream cannot be written to

show

public void show()
Shows the contents of the keystore.


arrayToString

private static java.lang.String arrayToString(byte[] data)