org.glite.security.util
Class TrustStorage

java.lang.Object
  extended by org.glite.security.util.TrustStorage

public class TrustStorage
extends java.lang.Object

A class that handles the information obtained from the trust directory.

Author:
hahkala

Constructor Summary
TrustStorage(java.lang.String storagePath)
          Deprecated. use the constructor TrustStorage(String, CaseInsensitiveProperties) instead.
TrustStorage(java.lang.String storagePath, CaseInsensitiveProperties props)
          Generates a new TrustStorage instance.
 
Method Summary
 void checkUpdate()
          Checks the trust store.
 FullTrustAnchor[] getAnchors()
          Used to get the list of trust anchors in the storage.
 FullTrustAnchor[] getAnchors(java.lang.String hash)
          Returns the anchors that correspond to the given hash.
 void loadAnchors()
          Deprecated. use checkUpdating also for initial loading.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrustStorage

public TrustStorage(java.lang.String storagePath)
             throws java.io.IOException,
                    java.security.cert.CertificateException,
                    java.text.ParseException
Deprecated. use the constructor TrustStorage(String, CaseInsensitiveProperties) instead.

Generates a new TrustStorage instance.

Parameters:
storagePath - The path to the trust anchors, CRLs and name spaces.
Throws:
java.io.IOException - If there is a file access problem.
java.security.cert.CertificateException - in case the certificate handling fails.
java.text.ParseException - in case the namespace parsing fails.

TrustStorage

public TrustStorage(java.lang.String storagePath,
                    CaseInsensitiveProperties props)
             throws java.io.IOException,
                    java.security.cert.CertificateException,
                    java.text.ParseException
Generates a new TrustStorage instance.

Parameters:
storagePath - The path to the trust anchors, CRLs and name spaces.
props - the properties to pass along for child classes to use.
Throws:
java.io.IOException - If there is a file access problem.
java.security.cert.CertificateException - in case the certificate handling fails.
java.text.ParseException - in case the namespace parsing fails.
Method Detail

getAnchors

public FullTrustAnchor[] getAnchors(java.lang.String hash)
Returns the anchors that correspond to the given hash.

Parameters:
hash - The hash used to identify the CA.
Returns:
The array of trust anchors that are identified by the hash.

loadAnchors

public void loadAnchors()
                 throws java.io.IOException,
                        java.security.cert.CertificateException,
                        java.text.ParseException
Deprecated. use checkUpdating also for initial loading.

Loads all the trust anchors into the internal structure. Used by the constructor.

Throws:
java.io.IOException - Thrown in case there is problems reading the files.
java.security.cert.CertificateException - Thrown in case there is problems parsing the Certificates.
java.text.ParseException - Thrown in case the namespace file parsing fails.

checkUpdate

public void checkUpdate()
                 throws java.io.IOException,
                        java.security.cert.CertificateException,
                        java.text.ParseException
Checks the trust store. It updates the existing CAs, CRLs and namespace definitions in case the files have changed. It also adds any new CAs along with their CRL and namespaces and removes CAs that have been removed from the storage.

Throws:
java.io.IOException - in case there is a problem reading files from the file system.
java.security.cert.CertificateException - in case there is problems parsing the CA certificates or CRLs.
java.text.ParseException - in case there is problems parsing the name space files.

getAnchors

public FullTrustAnchor[] getAnchors()
Used to get the list of trust anchors in the storage.

Returns:
The array of trust anchors in the storage.