|
Agent System POND 1.2 (28.2.2002) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--PkgAgentSystem.Crypto.PersonalSecurityStore
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)!
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 |
|
Field Detail |
protected KeyStore agentIdentities
KeyStore
for agent identities and the private keys of agentsprotected KeyStore owners
KeyStore
for owners and their private keysprotected KeyStore keysAndTrustedCerts
KeyStore
for trusted certificates (=CAs) and general pairs of keysConstructor Detail |
protected PersonalSecurityStore(String filename, char[] password) throws KeyStoreException, FileNotFoundException
filename
- the name of the file containing the storepassword
- the password used for encrypting the store (if null, the store was not protected on writing)FileNotFoundException
- if the specified file could not be foundKeyStoreException
- if another error occured (algorithm not available, wrong password, ...)protected PersonalSecurityStore()
Method Detail |
public void writePersonalSecurityStore(String filename, char[] password) throws KeyStoreException, IOException
filename
- the file to write topassword
- the password used to encrypt it (if null, no protection!)KeyStoreException
- if an error occured writing the data (no such algorithm, certificate encoding problems)IOException
- if the file could not be written topublic Enumeration getAgentIdentityNames() throws KeyStoreException
AgentIdentity
objectsAgentIdentity
objectspublic void addAgentPrivateKeyAndIdentity(NamedKeyAndCertificate ident) throws KeyStoreException
ident
- the identity and the private keyKeyStoreException
- if the data could not be storedpublic NamedKeyAndCertificate getAgentPrivateKeyAndIdentity(String name) throws KeyStoreException
name
- the name of the identity to retrieveKeyStoreException
- if an error occured retrieving the datapublic void deleteAgentIdentity(String name) throws KeyStoreException
KeyStoreException
- if an error occured during deleting the datapublic Enumeration getOwnerCertificateNames() throws KeyStoreException
public void addOwnerPrivateKeyAndCertificate(NamedKeyAndCertificate owner) throws KeyStoreException
owner
- the private key and the certificate of the ownerKeyStoreException
- if the data could not be storedpublic NamedKeyAndCertificate getOwnerPrivateKeyAndCertificate(String name) throws KeyStoreException
name
- the name of the owners certificateKeyStoreException
- if an error occured retrieving the datapublic void deleteOwner(String name) throws KeyStoreException
KeyStoreException
- if an error occured during deleting the datapublic void addKeyPair(NamedKeyPair nkp) throws KeyStoreException
nkp
- the key pairKeyStoreException
- if the data could not be storedpublic Enumeration getKeyPairNames() throws KeyStoreException
public NamedKeyPair getKeyPair(String name) throws KeyStoreException
name
- the name of the key pairKeyStoreException
- if an error occured retrieving the datapublic void deleteKeyPair(String name) throws KeyStoreException
KeyStoreException
- if an error occured during deleting the datapublic void addTrustedCertificate(String name, Certificate cert) throws KeyStoreException
name
- the name to store the certificate undercert
- the certificateKeyStoreException
- if the data could not be storedpublic Certificate getTrustedCertificate(String name) throws KeyStoreException
name
- the name of the trusted certificateKeyStoreException
- if an error occured retrieving the datapublic Enumeration getTrustedCertificateNames() throws KeyStoreException
public void deleteTrustedCertificate(String name) throws KeyStoreException
KeyStoreException
- if an error occured during deleting the dataprotected void createStore() throws KeyStoreException
KeyStoreException
.KeyStoreException
- if an error occured (algorithm not available, invalid key, certificate problem)
|
Agent System POND 1.2 (28.2.2002) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |