uk.ac.soton.itinnovation.grid.comms.client
Class CertificateFileTrustValidator

java.lang.Object
  extended by uk.ac.soton.itinnovation.grid.comms.client.CertificateFileTrustValidator
All Implemented Interfaces:
CertificateTrustValidator

public class CertificateFileTrustValidator
extends Object
implements CertificateTrustValidator


Constructor Summary
CertificateFileTrustValidator()
          Create a CertificateFileTrustValidator that loads the trusted certificates from the GRIA client's "conf/trustedCertificates" directory.
CertificateFileTrustValidator(File directory)
          Create a CertificateFileTrustValidator that gets the trusted certificates from a directory.
 
Method Summary
 boolean isCertificateTrusted(X509Certificate[] chain)
          Decide whether to trust a server's certificate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CertificateFileTrustValidator

public CertificateFileTrustValidator()
                              throws CertificateException,
                                     FileNotFoundException
Create a CertificateFileTrustValidator that loads the trusted certificates from the GRIA client's "conf/trustedCertificates" directory.

Throws:
CertificateException
FileNotFoundException

CertificateFileTrustValidator

public CertificateFileTrustValidator(File directory)
                              throws FileNotFoundException,
                                     CertificateException
Create a CertificateFileTrustValidator that gets the trusted certificates from a directory. All files in the directory that end in ".crt", ".pem" or ".der" (and don't start with ".") are loaded.

Parameters:
directory - the directory to load certificates from
Throws:
CertificateException
FileNotFoundException
Method Detail

isCertificateTrusted

public boolean isCertificateTrusted(X509Certificate[] chain)
Description copied from interface: CertificateTrustValidator
Decide whether to trust a server's certificate. Called to check both the TLS and message-level certificates. In both cases, it is only called if the default checks fail.

Specified by:
isCertificateTrusted in interface CertificateTrustValidator
Parameters:
chain - the server's certificate chain
Returns:
true if we should trust it


Copyright © 2001-2008 University of Southampton IT Innovation Centre. All Rights Reserved.