Agent System POND 1.2 (28.2.2002)

PkgAgentSystem.Crypto
Class PersonalSecurityStore

java.lang.Object
  |
  +--PkgAgentSystem.Crypto.PersonalSecurityStore
Direct Known Subclasses:
IAIKSecurityStore

public class PersonalSecurityStore
extends Object

A store for agent identities, their private keys, trusted certificates, general keypairs and certificates and private keys of owners of agents. Uses three standard KeyStore objects. Can only be created through a PersonalSecurityStoreFactory, which will supply a suitable implementation. Can either be created for reading an existing store (provide filename and password) or creating a new and empty store. The latter is not available here but only in subclasses:
The java framework does not supply classes for creating certificates, so each cryptography provider has to implement them for himself. Therefore they cannot be included here, as this class is independent from the provider used. For each cryptography provider a subclass has to be written, which uses the proprietary classes to create certificates. Also the factory has to be adapted to create a suitable class.

Owner certificates and trusted certificates may have only names consisting solely of lower case characters (the Sun KeyStore treats all names as lowercase)!

Version:
1.0, 1.7.2000
Author:
Michael Sonntag
See Also:
PersonalSecurityStoreFactory, KeyStore

Field Summary
protected  KeyStore agentIdentities
          KeyStore for agent identities and the private keys of agents
protected  KeyStore keysAndTrustedCerts
          KeyStore for trusted certificates (=CAs) and general pairs of keys
protected  KeyStore owners
          KeyStore for owners and their private keys
 
Constructor Summary
protected PersonalSecurityStore()
          Creates a new and empty security store.
protected PersonalSecurityStore(String filename, char[] password)
          Creates a new security store by reading the content from a file protected with a certain password.
 
Method Summary
 void addAgentPrivateKeyAndIdentity(NamedKeyAndCertificate ident)
          Add an agents private key and his identity to the store.
 void addKeyPair(NamedKeyPair nkp)
          Add a key pair to the store.
 void addOwnerPrivateKeyAndCertificate(NamedKeyAndCertificate owner)
          Add an owners private key and the according certificate to the store.
 void addTrustedCertificate(String name, Certificate cert)
          Add a trusted certificate to the store.
protected  void createStore()
          Creates all the necessary keys, certificates, ... for basic work of the agent system.
Not implemented here.
 void deleteAgentIdentity(String name)
          Removes a private key and the agent identity from the store.
 void deleteKeyPair(String name)
          Removes a key pair from the store.
 void deleteOwner(String name)
          Removes a private key and the certificate of an owner from the store.
 void deleteTrustedCertificate(String name)
          Removes a trusted certificate from the store.
 Enumeration getAgentIdentityNames()
          Retrieve all the names for stored AgentIdentity objects
 NamedKeyAndCertificate getAgentPrivateKeyAndIdentity(String name)
          Retrieves an agents identity and its private key from the store.
 NamedKeyPair getKeyPair(String name)
          Retrieves a key pair from the store.
 Enumeration getKeyPairNames()
          Retrieve all the names for stored key pairs
 Enumeration getOwnerCertificateNames()
          Retrieve all the names for stored owner certificates
 NamedKeyAndCertificate getOwnerPrivateKeyAndCertificate(String name)
          Retrieves an owners certificate and its private key from the store.
 Certificate getTrustedCertificate(String name)
          Retrieves a trusted certificate from the store.
 Enumeration getTrustedCertificateNames()
          Retrieve all the names for stored trusted certificates
 void writePersonalSecurityStore(String filename, char[] password)
          Writes the security store to a file and protectes it with a password.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

agentIdentities

protected KeyStore agentIdentities
KeyStore for agent identities and the private keys of agents

owners

protected KeyStore owners
KeyStore for owners and their private keys

keysAndTrustedCerts

protected KeyStore keysAndTrustedCerts
KeyStore for trusted certificates (=CAs) and general pairs of keys
Constructor Detail

PersonalSecurityStore

protected PersonalSecurityStore(String filename,
                                char[] password)
                         throws KeyStoreException,
                                FileNotFoundException
Creates a new security store by reading the content from a file protected with a certain password.
Parameters:
filename - the name of the file containing the store
password - the password used for encrypting the store (if null, the store was not protected on writing)
Throws:
FileNotFoundException - if the specified file could not be found
KeyStoreException - if another error occured (algorithm not available, wrong password, ...)

PersonalSecurityStore

protected PersonalSecurityStore()
Creates a new and empty security store.
Method Detail

writePersonalSecurityStore

public void writePersonalSecurityStore(String filename,
                                       char[] password)
                                throws KeyStoreException,
                                       IOException
Writes the security store to a file and protectes it with a password.
Parameters:
filename - the file to write to
password - the password used to encrypt it (if null, no protection!)
Throws:
KeyStoreException - if an error occured writing the data (no such algorithm, certificate encoding problems)
IOException - if the file could not be written to

getAgentIdentityNames

public Enumeration getAgentIdentityNames()
                                  throws KeyStoreException
Retrieve all the names for stored AgentIdentity objects
Returns:
an enumeration of the names of all AgentIdentity objects

addAgentPrivateKeyAndIdentity

public void addAgentPrivateKeyAndIdentity(NamedKeyAndCertificate ident)
                                   throws KeyStoreException
Add an agents private key and his identity to the store.
Parameters:
ident - the identity and the private key
Throws:
KeyStoreException - if the data could not be stored

getAgentPrivateKeyAndIdentity

public NamedKeyAndCertificate getAgentPrivateKeyAndIdentity(String name)
                                                     throws KeyStoreException
Retrieves an agents identity and its private key from the store.
Parameters:
name - the name of the identity to retrieve
Returns:
the private key and the certificate of the identity or null if the name was not found
Throws:
KeyStoreException - if an error occured retrieving the data

deleteAgentIdentity

public void deleteAgentIdentity(String name)
                         throws KeyStoreException
Removes a private key and the agent identity from the store.
Throws:
KeyStoreException - if an error occured during deleting the data

getOwnerCertificateNames

public Enumeration getOwnerCertificateNames()
                                     throws KeyStoreException
Retrieve all the names for stored owner certificates
Returns:
an enumeration of the names of all owner certificates

addOwnerPrivateKeyAndCertificate

public void addOwnerPrivateKeyAndCertificate(NamedKeyAndCertificate owner)
                                      throws KeyStoreException
Add an owners private key and the according certificate to the store.
Parameters:
owner - the private key and the certificate of the owner
Throws:
KeyStoreException - if the data could not be stored

getOwnerPrivateKeyAndCertificate

public NamedKeyAndCertificate getOwnerPrivateKeyAndCertificate(String name)
                                                        throws KeyStoreException
Retrieves an owners certificate and its private key from the store.
Parameters:
name - the name of the owners certificate
Returns:
the private key and the certificate of the owner or null if the name was not found
Throws:
KeyStoreException - if an error occured retrieving the data

deleteOwner

public void deleteOwner(String name)
                 throws KeyStoreException
Removes a private key and the certificate of an owner from the store.
Throws:
KeyStoreException - if an error occured during deleting the data

addKeyPair

public void addKeyPair(NamedKeyPair nkp)
                throws KeyStoreException
Add a key pair to the store.
Parameters:
nkp - the key pair
Throws:
KeyStoreException - if the data could not be stored

getKeyPairNames

public Enumeration getKeyPairNames()
                            throws KeyStoreException
Retrieve all the names for stored key pairs
Returns:
an enumeration of the names of all key pairs

getKeyPair

public NamedKeyPair getKeyPair(String name)
                        throws KeyStoreException
Retrieves a key pair from the store.
Parameters:
name - the name of the key pair
Returns:
the key pair or null if the name was not found
Throws:
KeyStoreException - if an error occured retrieving the data

deleteKeyPair

public void deleteKeyPair(String name)
                   throws KeyStoreException
Removes a key pair from the store.
Throws:
KeyStoreException - if an error occured during deleting the data

addTrustedCertificate

public void addTrustedCertificate(String name,
                                  Certificate cert)
                           throws KeyStoreException
Add a trusted certificate to the store.
Parameters:
name - the name to store the certificate under
cert - the certificate
Throws:
KeyStoreException - if the data could not be stored

getTrustedCertificate

public Certificate getTrustedCertificate(String name)
                                  throws KeyStoreException
Retrieves a trusted certificate from the store.
Parameters:
name - the name of the trusted certificate
Returns:
the trusted certificate or null if the name was not found
Throws:
KeyStoreException - if an error occured retrieving the data

getTrustedCertificateNames

public Enumeration getTrustedCertificateNames()
                                       throws KeyStoreException
Retrieve all the names for stored trusted certificates
Returns:
an enumeration of the names of all trusted certificates

deleteTrustedCertificate

public void deleteTrustedCertificate(String name)
                              throws KeyStoreException
Removes a trusted certificate from the store.
Throws:
KeyStoreException - if an error occured during deleting the data

createStore

protected void createStore()
                    throws KeyStoreException
Creates all the necessary keys, certificates, ... for basic work of the agent system.
Not implemented here. Always throws a KeyStoreException.
Throws:
KeyStoreException - if an error occured (algorithm not available, invalid key, certificate problem)

Agent System POND 1.2 (28.2.2002)

Submit a bug

Copyright 2001,2002 Michael Sonntag & Institute for Information Processing and Microprocessor Technology (FIM), Johannes-Kepler-University Linz, Altenbergerstr. 69, A-4040 Linz, Austria.