FileDocCategorySizeDatePackage
BasicConstraints.javaAPI DocAndroid 1.5 API4147Wed May 06 22:41:06 BST 2009org.bouncycastle.asn1.x509

BasicConstraints

public class BasicConstraints extends org.bouncycastle.asn1.ASN1Encodable

Fields Summary
org.bouncycastle.asn1.DERBoolean
cA
org.bouncycastle.asn1.DERInteger
pathLenConstraint
Constructors Summary
public BasicConstraints(org.bouncycastle.asn1.ASN1Sequence seq)

        if (seq.size() == 0)
        {
            this.cA = null;
            this.pathLenConstraint = null;
        }
        else
        {
            this.cA = DERBoolean.getInstance(seq.getObjectAt(0));
            if (seq.size() > 1)
            {
                this.pathLenConstraint = DERInteger.getInstance(seq.getObjectAt(1));
            }
        }
    
public BasicConstraints(boolean cA, int pathLenConstraint)

deprecated
use one of the other two unambigous constructors.
param
cA
param
pathLenConstraint

        if (cA)
        {
            // BEGIN android-changed
            this.cA = DERBoolean.getInstance(cA);
            // END android-changed
            this.pathLenConstraint = new DERInteger(pathLenConstraint);
        }
        else
        {
            this.cA = null;
            this.pathLenConstraint = null;
        }
    
public BasicConstraints(boolean cA)

        if (cA)
        {
            // BEGIN android-changed
            this.cA = DERBoolean.TRUE;
            // END android-changed
        }
        else
        {
            this.cA = null;
        }
        this.pathLenConstraint = null;
    
public BasicConstraints(int pathLenConstraint)
create a cA=true object for the given path length constraint.

param
pathLenConstraint

        // BEGIN android-changed
        this.cA = DERBoolean.TRUE;
        // END android-changed
        this.pathLenConstraint = new DERInteger(pathLenConstraint);
    
Methods Summary
public static org.bouncycastle.asn1.x509.BasicConstraintsgetInstance(org.bouncycastle.asn1.ASN1TaggedObject obj, boolean explicit)


       
         
                  
    
        return getInstance(ASN1Sequence.getInstance(obj, explicit));
    
public static org.bouncycastle.asn1.x509.BasicConstraintsgetInstance(java.lang.Object obj)

        if (obj == null || obj instanceof BasicConstraints)
        {
            return (BasicConstraints)obj;
        }
        else if (obj instanceof ASN1Sequence)
        {
            return new BasicConstraints((ASN1Sequence)obj);
        }

        throw new IllegalArgumentException("unknown object in factory");
    
public java.math.BigIntegergetPathLenConstraint()

        if (pathLenConstraint != null)
        {
            return pathLenConstraint.getValue();
        }

        return null;
    
public booleanisCA()

        return (cA != null) && cA.isTrue();
    
public org.bouncycastle.asn1.DERObjecttoASN1Object()
Produce an object suitable for an ASN1OutputStream.
BasicConstraints := SEQUENCE {
cA BOOLEAN DEFAULT FALSE,
pathLenConstraint INTEGER (0..MAX) OPTIONAL
}

        ASN1EncodableVector  v = new ASN1EncodableVector();

        if (cA != null)
        {
            v.add(cA);
    
            if (pathLenConstraint != null)
            {
                v.add(pathLenConstraint);
            }
        }

        return new DERSequence(v);
    
public java.lang.StringtoString()

        if (pathLenConstraint == null)
        {
            if (cA == null)
            {
                return "BasicConstraints: isCa(false)";
            }
            return "BasicConstraints: isCa(" + this.isCA() + ")";
        }
        return "BasicConstraints: isCa(" + this.isCA() + "), pathLenConstraint = " + pathLenConstraint.getValue();