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)
          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 hash given.
 void loadAnchors()
          Loads all the trustanchors.
 
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
Generates a new TrustStorage instance.

Parameters:
storagePath - The path to the trust anchors, CRLs and namespaces.
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 hash given.

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

loadAnchors

public void loadAnchors()
                 throws java.io.IOException,
                        java.security.cert.CertificateException,
                        java.text.ParseException
Loads all the trustanchors.

Throws:
java.io.IOException - Thrown in cas there is problems readig 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.