Project JXTA

net.jxta.impl.membership.pse
Class PSEConfig

java.lang.Object
  extended by net.jxta.impl.membership.pse.PSEConfig

public final class PSEConfig
extends Object

Manages the state of a Personal Security Enviroment.


Constructor Summary
PSEConfig(KeyStoreManager storeManager, char[] password)
          Standard constructor.
 
Method Summary
 void erase()
          Remove an existing PSE enviroment.
 void erase(ID id)
          Erases the specified id from the keystore.
protected  void finalize()
          
 PrivateKey getKey(ID id, char[] key_password)
          Returns the private key for the specified ID.
 ID[] getKeysList()
          Returns the list of root certificates for which there is an associated local private key.
(package private)  ID[] getKeysList(char[] store_password)
          Returns the list of root certificates for which there is an associated local private key.
 KeyStore getKeyStore()
          Gets a copy of the keystore associated with this PSE instance.
 X509Certificate getTrustedCertificate(ID id)
          Returns the trusted cert for the specified id.
(package private)  X509Certificate getTrustedCertificate(ID id, char[] store_password)
          Returns the trusted cert for the specified id.
 X509Certificate[] getTrustedCertificateChain(ID id)
          Returns the trusted cert chain for the specified id.
 ID getTrustedCertificateID(X509Certificate cert)
          Returns the ID of the provided certificate or null if the certificate is not found in the keystore.
 ID[] getTrustedCertsList()
          Returns the list of the trusted certificates available in this keystore.
 void initialize()
          Create a new PSE enviroment.
 boolean isInitialized()
          Returns true if the PSE needs to be configured before it can be used.
 void setKey(ID id, Certificate[] certchain, PrivateKey key, char[] key_password)
          Adds a key to the pse keystore.
 void setKeyStorePassword(char[] store_password)
          Sets the password to be used when unlocking the keystore.
 void setTrustedCertificate(ID id, X509Certificate cert)
          Adds a trusted certificate with the specified id to the key store.
(package private)  boolean validPasswd(ID id, char[] store_password, char[] key_password)
          Check if the provided passwords are correct for the specified identity.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PSEConfig

public PSEConfig(KeyStoreManager storeManager,
                 char[] password)
Standard constructor.

Method Detail

setKeyStorePassword

public final void setKeyStorePassword(char[] store_password)
Sets the password to be used when unlocking the keystore.


finalize

protected void finalize()
                 throws Throwable

Overrides:
finalize in class Object
Throws:
Throwable

isInitialized

public boolean isInitialized()
Returns true if the PSE needs to be configured before it can be used.


initialize

public void initialize()
                throws KeyStoreException,
                       IOException
Create a new PSE enviroment.

Throws:
KeyStoreException - When the wrong keystore has been provided.
IOException - For errors related to processing the keystore.

erase

public void erase()
           throws IOException
Remove an existing PSE enviroment.

Throws:
IOException

getKeyStore

public KeyStore getKeyStore()
Gets a copy of the keystore associated with this PSE instance.

Returns:
keystore or null if it can't be retrieved.

validPasswd

boolean validPasswd(ID id,
                    char[] store_password,
                    char[] key_password)
Check if the provided passwords are correct for the specified identity.

Parameters:
keyID - The identity to be validated.
store_password - The password used to unlock the keystore.
key_password - The password used to unlock the individual key.
Returns:
true if the passwords were valid for the given id otherwise false.

getTrustedCertsList

public ID[] getTrustedCertsList()
                         throws KeyStoreException,
                                IOException
Returns the list of the trusted certificates available in this keystore.

Parameters:
store_password - The password used to unlock the keystore.
Returns:
an array of the IDs of the available trusted certificates.
Throws:
KeyStoreException - When the wrong keystore has been provided.
IOException - For errors related to processing the keystore.

getKeysList

public ID[] getKeysList()
                 throws KeyStoreException,
                        IOException
Returns the list of root certificates for which there is an associated local private key.

Returns:
an array of the available keys. May be an empty array.
Throws:
KeyStoreException
IOException

getKeysList

ID[] getKeysList(char[] store_password)
           throws KeyStoreException,
                  IOException
Returns the list of root certificates for which there is an associated local private key.

Parameters:
store_password - The password used to unlock the keystore.
Returns:
an array of the available keys. May be an empty array.
Throws:
KeyStoreException
IOException

getTrustedCertificateID

public ID getTrustedCertificateID(X509Certificate cert)
                           throws KeyStoreException,
                                  IOException
Returns the ID of the provided certificate or null if the certificate is not found in the keystore.

Throws:
KeyStoreException
IOException

getTrustedCertificate

public X509Certificate getTrustedCertificate(ID id)
                                      throws KeyStoreException,
                                             IOException
Returns the trusted cert for the specified id.

Returns:
Certificate for the specified ID or null if the store does not contain the specified certificate.
Throws:
KeyStoreException
IOException

getTrustedCertificate

X509Certificate getTrustedCertificate(ID id,
                                      char[] store_password)
                                throws KeyStoreException,
                                       IOException
Returns the trusted cert for the specified id.

Returns:
Certificate for the specified ID or null if the store does not contain the specified certificate.
Throws:
KeyStoreException
IOException

getTrustedCertificateChain

public X509Certificate[] getTrustedCertificateChain(ID id)
                                             throws KeyStoreException,
                                                    IOException
Returns the trusted cert chain for the specified id.

Returns:
Certificate chain for the specified ID or null if the store does not contain the specified certificate.
Throws:
KeyStoreException
IOException

getKey

public PrivateKey getKey(ID id,
                         char[] key_password)
                  throws KeyStoreException,
                         IOException
Returns the private key for the specified ID.

Returns:
Certificate for the specified ID.
Throws:
KeyStoreException
IOException

setTrustedCertificate

public void setTrustedCertificate(ID id,
                                  X509Certificate cert)
                           throws KeyStoreException,
                                  IOException
Adds a trusted certificate with the specified id to the key store.

Throws:
KeyStoreException
IOException

setKey

public void setKey(ID id,
                   Certificate[] certchain,
                   PrivateKey key,
                   char[] key_password)
            throws KeyStoreException,
                   IOException
Adds a key to the pse keystore. The key is stored using the provided key password.

Parameters:
Certificate - for the specified ID.
Throws:
KeyStoreException
IOException

erase

public void erase(ID id)
           throws KeyStoreException,
                  IOException
Erases the specified id from the keystore.

Throws:
KeyStoreException
IOException

JXTA J2SE