JXTA

net.jxta.impl.membership.pse
Interface KeyStoreManager

All Known Implementing Classes:
CMKeyStoreManager, FileKeyStoreManager, URIKeyStoreManager

public interface KeyStoreManager

Abstracts the management of KeyStores. This is commonly used to abstract the location of the KeyStore and the details of creating, loading, saving and deleting the KeyStore.

Applications should not assume that accesses to KeyStoreManager are thread safe. All access to the KeyStoreManager should be externally synchronized on the KeyStoreManager object.


Method Summary
 void createKeyStore(char[] password)
          Create the KeyStore using the specified KeyStore passphrase.
 void eraseKeyStore()
          Erase the KeyStore.
 boolean isInitialized()
          Returns true if the KeyStore has been initialized (created).
 boolean isInitialized(char[] password)
          Returns true if the Keystore has been initialized (created).
 KeyStore loadKeyStore(char[] password)
          Load the KeyStore.
 void saveKeyStore(KeyStore store, char[] password)
          Save the provided KeyStore using the specified KeyStore passphrase.
 

Method Detail

isInitialized

boolean isInitialized()
                      throws KeyStoreException
Returns true if the KeyStore has been initialized (created). Since this method does not provide a passphrase it is really only useful for determining if a new KeyStore needs to be created.

Returns:
true if the KeyStore has been previously initialized otherwise false.
Throws:
KeyStoreException - If the KeyStore is protected by a store password that has not been set.

isInitialized

boolean isInitialized(char[] password)
                      throws KeyStoreException
Returns true if the Keystore has been initialized (created). This method also ensures that the provided passphrase is valid for the keystore.

Parameters:
password - The KeyStore passphrase.
Returns:
true if the Keystore has been initialized otherwise false.
Throws:
KeyStoreException - If an incorrect KeyStore password is provided.

createKeyStore

void createKeyStore(char[] password)
                    throws IOException,
                           KeyStoreException
Create the KeyStore using the specified KeyStore passphrase.

Parameters:
password - The KeyStore passphrase.
Throws:
KeyStoreException - If an incorrect KeyStore passphrase is provided.
IOException - If there is a problem creating the KeyStore.

loadKeyStore

KeyStore loadKeyStore(char[] password)
                      throws IOException,
                             KeyStoreException
Load the KeyStore.

Parameters:
password - The KeyStore passphrase.
Returns:
the keystore
Throws:
KeyStoreException - If an incorrect KeyStore password is provided.
IOException - If there is a problem loading the KeyStore.

saveKeyStore

void saveKeyStore(KeyStore store,
                  char[] password)
                  throws IOException,
                         KeyStoreException
Save the provided KeyStore using the specified KeyStore passphrase.

Parameters:
store - The KeyStore to save.
password - The encryption passphrase for the keystore.
Throws:
IOException - Thrown for errors writing the keystore.
KeyStoreException - Thrown for errors with the provided key or key store.

eraseKeyStore

void eraseKeyStore()
                   throws IOException
Erase the KeyStore. Some KeyStore implementations may not allow the KeyStore container itself to be erased and in some cases specific certificates and keys may be unerasable. All implementations should erase all user provided certificates and keys.

Throws:
IOException - If there is a problem erasing the KeyStore or the KeyStore cannot be erased.

JXSE