JXTA

net.jxta.impl.membership.pse
Class URIKeyStoreManager

java.lang.Object
  extended by net.jxta.impl.membership.pse.URIKeyStoreManager
All Implemented Interfaces:
KeyStoreManager

public class URIKeyStoreManager
extends Object
implements KeyStoreManager

Manages a Keystore located at URI. This version precludes KeyStores which are built from multiple URIs.


Constructor Summary
URIKeyStoreManager(String type, String provider, URI location)
          Default constructor.
 
Method Summary
 void createKeyStore(char[] store_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[] store_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.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

URIKeyStoreManager

public URIKeyStoreManager(String type,
                          String provider,
                          URI location)
                   throws NoSuchProviderException,
                          KeyStoreException
Default constructor.

Throws:
NoSuchProviderException
KeyStoreException
Method Detail

isInitialized

public boolean isInitialized()
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.

Specified by:
isInitialized in interface KeyStoreManager
Returns:
true if the KeyStore has been previously initialized otherwise false.

isInitialized

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

Specified by:
isInitialized in interface KeyStoreManager
Parameters:
store_password - The KeyStore passphrase.
Returns:
true if the Keystore has been initialized otherwise false.

createKeyStore

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

Specified by:
createKeyStore in interface KeyStoreManager
Parameters:
store_password - The KeyStore passphrase.
Throws:
KeyStoreException - If an incorrect KeyStore passphrase is provided.
IOException - If there is a problem creating the KeyStore.

loadKeyStore

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

Specified by:
loadKeyStore in interface KeyStoreManager
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

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

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

eraseKeyStore

public void eraseKeyStore()
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.

Specified by:
eraseKeyStore in interface KeyStoreManager

toString

public String toString()

Overrides:
toString in class Object

JXSE