anon.crypto
Class X509BasicConstraints

java.lang.Object
  extended by anon.crypto.AbstractX509Extension
      extended by anon.crypto.X509BasicConstraints

public class X509BasicConstraints
extends AbstractX509Extension

This class implements the BasicConstrains extension for X.509-certificates as specified in RFC 5280.

Author:
Robert Hirschberger
See Also:
http://tools.ietf.org/html/rfc5280

Field Summary
static java.lang.String IDENTIFIER
           
private  boolean m_cA
          true if the certificate belongs to a CA
private  int m_pathLenConstraint
          the maximal length of a certification path build from this cert to an end entity
 
Constructor Summary
X509BasicConstraints(boolean cA)
          Creates a new X509BasicConstrains objects with the specified value for cA.
X509BasicConstraints(org.bouncycastle.asn1.DERSequence a_extension)
          Creates an new X509BasicConstraints object from a BouncyCastle DERSequence
X509BasicConstraints(int pathLenConstraint)
          Creates a new X509BasicConstrains objects with pathLength limited to the specified value.
 
Method Summary
private static byte[] createDEROctets(boolean cA)
          Generates the DEROctets of this extension to hand over to the super class.
private static byte[] createDEROctets(int pathLenConstraint)
          Generates the DEROctets of this extension to hand over to the super class.
private  void createValue()
          Instantiates a new BouncyCastle BasicConstraints from the DEROctets of this extension an extracts the cA and pathLenConstraint values.
 java.lang.String getName()
          Returns the human-readable name of this extension.
 int getPathLengthConstraint()
           
 java.util.Vector getValues()
          This method returns all values of this extension in separated String objects.
 boolean isCA()
           
 
Methods inherited from class anon.crypto.AbstractX509Extension
equals, getBCExtension, getDEROctets, getIdentifier, getInstance, hashCode, isCritical, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

IDENTIFIER

public static final java.lang.String IDENTIFIER

m_cA

private boolean m_cA
true if the certificate belongs to a CA


m_pathLenConstraint

private int m_pathLenConstraint
the maximal length of a certification path build from this cert to an end entity

Constructor Detail

X509BasicConstraints

public X509BasicConstraints(boolean cA)
Creates a new X509BasicConstrains objects with the specified value for cA. This indicates if the certificate is a CA-certificate. This Extension is by default set to non-critical according to RFC 5280.

Parameters:
cA - indicates if the certificate belongs to a CA.

X509BasicConstraints

public X509BasicConstraints(int pathLenConstraint)
Creates a new X509BasicConstrains objects with pathLength limited to the specified value. Note that cA is always set to true if a pathLength is specified. This Extension is by default set to non-critical according to RFC 5280.

Parameters:
pathLenConstraint - the maximum length of a certification Path

X509BasicConstraints

public X509BasicConstraints(org.bouncycastle.asn1.DERSequence a_extension)
Creates an new X509BasicConstraints object from a BouncyCastle DERSequence

Parameters:
a_extension - the extions as DERSequence
Method Detail

createDEROctets

private static byte[] createDEROctets(int pathLenConstraint)
Generates the DEROctets of this extension to hand over to the super class.

Parameters:
pathLenConstraint - the maximum length of a certification Path
Returns:
the DEROctets of this extension

createDEROctets

private static byte[] createDEROctets(boolean cA)
Generates the DEROctets of this extension to hand over to the super class.

Parameters:
cA - indicates if the certificate belongs to a CA.
Returns:
the DEROctets of this extension

createValue

private void createValue()
Instantiates a new BouncyCastle BasicConstraints from the DEROctets of this extension an extracts the cA and pathLenConstraint values.


isCA

public boolean isCA()
Returns:
if the certificate belongs to a CA

getPathLengthConstraint

public int getPathLengthConstraint()
Returns:
the maximal length of a certificate that is build from this certificate to an end entity

getName

public java.lang.String getName()
Description copied from class: AbstractX509Extension
Returns the human-readable name of this extension.

Specified by:
getName in class AbstractX509Extension
Returns:
"BasicConstraints"

getValues

public java.util.Vector getValues()
Description copied from class: AbstractX509Extension
This method returns all values of this extension in separated String objects. The values should be human readable.

Specified by:
getValues in class AbstractX509Extension
Returns:
a Vector containing the values for cA and pathLenConstraint as human readable Strings.