org.globus.gsi
Class SigningPolicy

java.lang.Object
  extended by org.globus.gsi.SigningPolicy

public class SigningPolicy
extends Object

Class that holds signing policy information. It contains the CA subject DN for which the signing policy is stored, an optional name of the file from which the policy was read in and if available a vector of Pattern that contain the DN pattern. The Pattern should use the grammar described in java.util.Pattern, see SigningPolicyParser#getPattern(). Note: All subject DNs should be in Globus format (with slashes) and in order (that is NOT reversed)


Constructor Summary
SigningPolicy(String caDN_)
          Creates a signing policy for the given CA DN
SigningPolicy(String caDN_, Vector patterns_)
          Creates a signing policy for the given CA DN and vector of policies.
SigningPolicy(String caDN_, Vector patterns_, String fileName_)
          Creates a signing policy for the given CA DN and vector of policies.
 
Method Summary
 String getCaSubject()
          Returns the CA subject DN
 String getFileName()
          Returns file name
 Vector getPatterns()
          Returns the allowed subject DN patterns.
 boolean isPolicyAvailable()
          Method to determine if a signing policy is available for a given DN.
 boolean isValidSubject(String subjectDN)
          Method to determine if the subject DN matches one of the patterns in the signing policy.
 void setFileName(String fileName_)
          Sets file name from which the signing policy was read.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SigningPolicy

public SigningPolicy(String caDN_)
Creates a signing policy for the given CA DN

Parameters:
caDN_ - Distinguished Name of the CA, in Globus format (with slashes) and not reversed. See CertUtil#toGlobusID()

SigningPolicy

public SigningPolicy(String caDN_,
                     Vector patterns_)
Creates a signing policy for the given CA DN and vector of policies. The policies are stored as java.util.Pattern, where each Pattern provdes a regexp format of the signing policy. See SigningPolicyParser#getPattern().

Parameters:
caDN_ - Distinguished Name of the CA, in Globus format (with slashes) and not reversed. See CertUtil.toGlobusID()
patterns_ - Vector of java.util.Pattern, each representing an allowed subject DN policy.

SigningPolicy

public SigningPolicy(String caDN_,
                     Vector patterns_,
                     String fileName_)
Creates a signing policy for the given CA DN and vector of policies. The policies are stored as java.util.Pattern, where each Pattern provdes a regexp format of the signing policy. See SigningPolicyParser#getPattern(). The optional filename stores the file from which the signing policy was read in.

Parameters:
caDN_ - Distinguished Name of the CA, in Globus format (with slashes) and not reversed. See CertUtil.toGlobusID()
patterns_ - Vector of java.util.Pattern, each representing an allowed subject DN policy.
fileName_ - name of the signing policy file.
Method Detail

getPatterns

public Vector getPatterns()
Returns the allowed subject DN patterns.

Returns:
Vector of patterns, each representing an allowed subject DN policy. Can be null or vector of size zero.

getCaSubject

public String getCaSubject()
Returns the CA subject DN

Returns:
CA's DN

getFileName

public String getFileName()
Returns file name

Returns:
name of file from which the signing policy was read. Can be null.

setFileName

public void setFileName(String fileName_)
Sets file name from which the signing policy was read.

Parameters:
fileName_ - File name.

isPolicyAvailable

public boolean isPolicyAvailable()
Method to determine if a signing policy is available for a given DN.

Returns:
If the patterns vector is not null and has atleast one element, true is returned. Else the method returns false.

isValidSubject

public boolean isValidSubject(String subjectDN)
Method to determine if the subject DN matches one of the patterns in the signing policy. Returns true if no policy is available, use isPolicyAvailable() to check presence of policy.

Parameters:
subjectDN - Subject DN to match
Returns:
Returns true of the subject DN matches one of the patterns in the policy or if no policy is available. Returns false otherwise.