org.globus.gsi
Class TrustedCertificates

java.lang.Object
  extended byorg.globus.gsi.TrustedCertificates
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
PureTLSTrustedCertificates

public class TrustedCertificates
extends Object
implements Serializable

Class that reads in and maintains trusted certificates and signing policy associated with the CAs.

See Also:
Serialized Form

Nested Class Summary
static class TrustedCertificates.CertFilter
           
 
Field Summary
static TrustedCertificates.CertFilter certFileFilter
           
static String SIGNING_POLICY_FILE_SUFFIX
          Default signing policy suffix.
 
Constructor Summary
protected TrustedCertificates()
           
  TrustedCertificates(X509Certificate[] certs)
           
  TrustedCertificates(X509Certificate[] certs, SigningPolicy[] policies)
           
 
Method Summary
static FilenameFilter getCertFilter()
           
 X509Certificate getCertificate(String subject)
           
 X509Certificate[] getCertificates()
           
static TrustedCertificates getDefault()
          Obtains the default set of trusted certificates and signing policy
static TrustedCertificates getDefaultTrustedCertificates()
          Obtains the default set of trusted certificates and signing policy
 SigningPolicy[] getSigningPolicies()
          Returns all signing policies
 SigningPolicy getSigningPolicy(String subject)
          Returns signing policy associated with the given CA subject.
 boolean isChanged()
          Indicates if the last reload caused new certificates to be loaded or existing certificates to be reloaded or any certificates removed
static TrustedCertificates load(String locations)
           
static X509Certificate[] loadCertificates(String locations)
          Loads X509 certificates and signing policy files from specified locations.
 void refresh()
           
 void reload(String locations)
           
static void setDefaultTrustedCertificates(TrustedCertificates trusted)
          Sets the default set of trusted certificates to use.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

certFileFilter

public static final TrustedCertificates.CertFilter certFileFilter

SIGNING_POLICY_FILE_SUFFIX

public static String SIGNING_POLICY_FILE_SUFFIX
Default signing policy suffix. The files are expected to be .signing_policy in the same directory as the trusted certificates.

Constructor Detail

TrustedCertificates

protected TrustedCertificates()

TrustedCertificates

public TrustedCertificates(X509Certificate[] certs)

TrustedCertificates

public TrustedCertificates(X509Certificate[] certs,
                           SigningPolicy[] policies)
Method Detail

getCertificates

public X509Certificate[] getCertificates()

getCertificate

public X509Certificate getCertificate(String subject)

getSigningPolicies

public SigningPolicy[] getSigningPolicies()
Returns all signing policies


getSigningPolicy

public SigningPolicy getSigningPolicy(String subject)
Returns signing policy associated with the given CA subject.

Parameters:
subject - CA's subject DN for which signing policy is required. The DN should be in Globus format (with slashes) and not reversed. See CertUtil.toGlobusID();
Returns:
Signing policy object associated with the CA's DN. Null if no policy was configured. SigningPolicy object might not have any applicable policy if none was configured or none was found in the policy file configured.

loadCertificates

public static X509Certificate[] loadCertificates(String locations)
Loads X509 certificates and signing policy files from specified locations. The locations can be either files or directories. The directories will be automatically traversed and all files in the form of hashcode.number and will be loaded automatically as trusted certificates. An attempt will be made to load signing policy for the CA associated with that hashcode from .signing_policy. If policy file is not found, no error will be thrown, only path validation code enforces the signing policy requirement.

Parameters:
locations - a list of certificate files/directories to load the certificates from. The locations are comma separated.
Returns:
java.security.cert.X509Certificate an array of loaded certificates

load

public static TrustedCertificates load(String locations)

getCertFilter

public static FilenameFilter getCertFilter()

refresh

public void refresh()

reload

public void reload(String locations)

isChanged

public boolean isChanged()
Indicates if the last reload caused new certificates to be loaded or existing certificates to be reloaded or any certificates removed


getDefaultTrustedCertificates

public static TrustedCertificates getDefaultTrustedCertificates()
Obtains the default set of trusted certificates and signing policy

Returns:
TrustedCertificates object.

setDefaultTrustedCertificates

public static void setDefaultTrustedCertificates(TrustedCertificates trusted)
Sets the default set of trusted certificates to use.

Parameters:
trusted - the new set of trusted certificates to use.

getDefault

public static TrustedCertificates getDefault()
Obtains the default set of trusted certificates and signing policy

Returns:
TrustedCertificates object.

toString

public String toString()