FileDocCategorySizeDatePackage
BasicConstraints.javaAPI DocAndroid 1.5 API4173Wed May 06 22:41:06 BST 2009org.apache.harmony.security.x509

BasicConstraints

public class BasicConstraints extends ExtensionValue
Basic Constraints Extension (OID == 2.5.29.19). The ASN.1 definition for Basic Constraints Extension is:
id-ce-basicConstraints OBJECT IDENTIFIER ::= { id-ce 19 }

BasicConstraints ::= SEQUENCE {
cA BOOLEAN DEFAULT FALSE,
pathLenConstraint INTEGER (0..MAX) OPTIONAL
}
(as specified in RFC 3280)

Fields Summary
private boolean
cA
private int
pathLenConstraint
public static org.apache.harmony.security.asn1.ASN1Type
ASN1
ASN.1 Encoder/Decoder.
Constructors Summary
public BasicConstraints(boolean cA, int pathLenConstraint)
Creates the extension object on the base of the values of fields of the structure..


    // Constructor for creating the extension without
    // encoding provided
                        
         
        this.cA = cA;
        this.pathLenConstraint = pathLenConstraint;
    
public BasicConstraints(byte[] encoding)
Creates the extension object on the base of its encoded form.

        super(encoding);
        Object[] values = (Object[]) ASN1.decode(encoding);
        cA = ((Boolean) values[0]).booleanValue();
        if (values[1] != null) {
            pathLenConstraint = new BigInteger((byte[]) values[1]).intValue();
        }
    
Methods Summary
public voiddumpValue(java.lang.StringBuffer buffer, java.lang.String prefix)
Places the string representation of extension value into the StringBuffer object.

        buffer.append(prefix).append("BasicConstraints [\n").append(prefix) //$NON-NLS-1$
            .append("  CA: ").append(cA) //$NON-NLS-1$
            .append("\n  ").append(prefix).append("pathLenConstraint: ") //$NON-NLS-1$ //$NON-NLS-2$
            .append(pathLenConstraint).append('\n").append(prefix)
            .append("]\n"); //$NON-NLS-1$
    
public booleangetCA()

        return cA;
    
public byte[]getEncoded()
Returns the encoded form of the object.

        if (encoding == null) {
            encoding = ASN1.encode(
                    new Object[] {Boolean.valueOf(cA),
                        BigInteger.valueOf(pathLenConstraint)});
        }
        return encoding;
    
public intgetPathLenConstraint()

        return pathLenConstraint;