net.sf.jguard.authentication.certificates
Class CertUtils

java.lang.Object
  extended by net.sf.jguard.authentication.certificates.CertUtils

public class CertUtils
extends java.lang.Object

Utility class to handle X509 certificates.

Author:
Simon Lebettre, Charles Gay

Constructor Summary
CertUtils()
           
 
Method Summary
static java.security.cert.X509Certificate getCertFromFile(java.lang.String path)
          Read a certificate from the specified filepath.
static java.util.Set getCertsFromDirectory(java.lang.String directoryPath)
          return all the certificates contained in the directory path.
static java.util.Set getTrustedAnchorsFromDirectory(java.lang.String directoryPath)
          return a Set of TrustAnchors (without nameConstraints) which comes from a directory path.
static java.util.Set getTrustedAnchorsFromDirectory(java.lang.String directoryPath, byte[] nameConstraints)
          return a Set of TrustAnchors (without nameConstraints) which comes from a directory path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CertUtils

public CertUtils()
Method Detail

getCertFromFile

public static java.security.cert.X509Certificate getCertFromFile(java.lang.String path)
Read a certificate from the specified filepath.

Parameters:
certificate - path
certificate -

getCertsFromDirectory

public static java.util.Set getCertsFromDirectory(java.lang.String directoryPath)
return all the certificates contained in the directory path.

Parameters:
directoryPath -
Returns:
certificates Set(an empty Set if the directoryPath is null)

getTrustedAnchorsFromDirectory

public static java.util.Set getTrustedAnchorsFromDirectory(java.lang.String directoryPath)
return a Set of TrustAnchors (without nameConstraints) which comes from a directory path.

Parameters:
directoryPath -
Returns:
TrustAnchor Set

getTrustedAnchorsFromDirectory

public static java.util.Set getTrustedAnchorsFromDirectory(java.lang.String directoryPath,
                                                           byte[] nameConstraints)
return a Set of TrustAnchors (without nameConstraints) which comes from a directory path.

Parameters:
directoryPath -
nameConstraints - constraints applied to all the TrustAnchor
Returns:
TrustAnchor Set