codec.x509.extensions
Class BasicConstraintsExtension

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.ArrayList
                    |
                    +--codec.asn1.ASN1AbstractCollection
                          |
                          +--codec.asn1.ASN1Sequence
                                |
                                +--codec.x509.X509Extension
                                      |
                                      +--codec.x509.extensions.BasicConstraintsExtension
All Implemented Interfaces:
ASN1Collection, ASN1Type, Cloneable, Collection, Externalizable, List, Serializable, X509Extension

public class BasicConstraintsExtension
extends X509Extension

This extension shall be critical.

  id-ce-extBasicConstraints OBJECT IDENTIFIER ::= {id-ce 19}
  BasicConstraintsSyntax ::= SEQUENCE {
    cA  BOOLEAN DEFAULT FALSE,
    pathLenConstraint INTEGER (0..MAX) OPTIONAL
  }
 
 	id-ce OBJECT IDENTIFIER  ::=  {joint-iso-ccitt(2) ds(5) 29}
 
 

Author:
mal little change : to be compatible to the ITU X690 Standard, Chapter 8,10, 11 i changed the constructor BasicConstraint(boolean ca, int pathLength). in case ca=false, the default value false is not encoded, this means the extension contents only its oid and an empty sequence. cval
See Also:
Serialized Form

Field Summary
protected  ASN1Sequence basicConstraintsSyntax
           
protected  ASN1Boolean cA
           
static String ID_CE_BASIC_CONSTRAINTS
           
protected  ASN1Integer pathLenConstraints
           
 
Fields inherited from class codec.x509.X509Extension
critical, extnID, extnValue
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
BasicConstraintsExtension()
           
BasicConstraintsExtension(boolean _cA, int _pathLenConstraints)
           
BasicConstraintsExtension(byte[] ext)
          Constructor for BasicConstraintsExtension.
 
Method Summary
 void decode(Decoder dec)
          Reads this collection from the given Decoder.
 int getPathLenConstraints()
          Returns the pathLenConstraints.
 boolean isCA()
          Returns the cA.
 void setCA(boolean _cA)
          Sets the cA.
 void setPathLenConstraints(int pathLenConstraints)
          Sets the pathLenConstraints.
 String toString(String offset)
          Returns a human-readable String representation of this extension with an offset String.
 
Methods inherited from class codec.x509.X509Extension
decodeExtensionValue, getCriticalExtensionOIDs, getEncoded, getExtensionValue, getNonCriticalExtensionOIDs, getOID, getValue, hasUnsupportedCriticalExtension, isCritical, setCritical, setOID, setValue, toString
 
Methods inherited from class codec.asn1.ASN1Sequence
getTag
 
Methods inherited from class codec.asn1.ASN1AbstractCollection
checkConstraints, encode, getCollection, getConstraint, getTagClass, isExplicit, isOptional, isType, readExternal, setConstraint, setExplicit, setOptional, writeExternal
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, remove, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.io.Externalizable
readExternal, writeExternal
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList
 

Field Detail

ID_CE_BASIC_CONSTRAINTS

public static final String ID_CE_BASIC_CONSTRAINTS

cA

protected ASN1Boolean cA

pathLenConstraints

protected ASN1Integer pathLenConstraints

basicConstraintsSyntax

protected ASN1Sequence basicConstraintsSyntax
Constructor Detail

BasicConstraintsExtension

public BasicConstraintsExtension()
                          throws Exception

BasicConstraintsExtension

public BasicConstraintsExtension(boolean _cA,
                                 int _pathLenConstraints)
                          throws Exception
Parameters:
_cA -  
_pathLenConstraints - <0 means infit (i.e. this field won't be set
Throws:
Exception -  

BasicConstraintsExtension

public BasicConstraintsExtension(byte[] ext)
                          throws ASN1Exception,
                                 IOException
Constructor for BasicConstraintsExtension.
Parameters:
ext -  
Throws:
ASN1Exception -  
IOException -  
Method Detail

isCA

public boolean isCA()
Returns the cA.
Returns:
ASN1Boolean

getPathLenConstraints

public int getPathLenConstraints()
Returns the pathLenConstraints.
Returns:
The path length or -1 if none is present in this extension.

setCA

public void setCA(boolean _cA)
           throws CertificateEncodingException
Sets the cA.
Parameters:
_cA - The cA to set

setPathLenConstraints

public void setPathLenConstraints(int pathLenConstraints)
                           throws Exception
Sets the pathLenConstraints.
Parameters:
pathLenConstraints - The pathLenConstraints to set

decode

public void decode(Decoder dec)
            throws ASN1Exception,
                   IOException
Description copied from class: ASN1AbstractCollection
Reads this collection from the given Decoder. This type is initialized with the decoded data. The components of the decoded collection must match the components of this collection. If they do then the components are also initialized with the decoded values. Otherwise an exception is thrown.
Overrides:
decode in class ASN1AbstractCollection
Following copied from class: codec.asn1.ASN1AbstractCollection
Parameters:
dec - The decoder to read from.

toString

public String toString(String offset)
Description copied from class: X509Extension
Returns a human-readable String representation of this extension with an offset String.
Overrides:
toString in class X509Extension
Following copied from class: codec.x509.X509Extension
Parameters:
offset - String that will be put before each line of output


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.