* null if the extension is not present
*/
public int getBasicConstraints() {
int res = -1;
byte[] ext_value;
DERDecoder dec;
ByteArrayInputStream bais;
ASN1Sequence seq;
ASN1Integer pathLen;
ASN1Boolean ca;
String bc_oid = "2.5.29.19";
// get the extension "basic constraints"
ext_value = getExtensionValue(bc_oid);
// is it present?
if (ext_value != null) {
// read the extension value through a byte array input stream
bais = new ByteArrayInputStream(ext_value);
try {
// build outer sequence
seq = new ASN1Sequence();
ca = new ASN1Boolean();
ca.setOptional(true);
seq.add(ca);
pathLen = new ASN1Integer();
pathLen.setOptional(true);
seq.add(pathLen);
/*
* Switched decoding to the correct way of doing it, which is to
* take the ASN.1 object and to call its decode() method, rather
* than calling readX() methods of the decoder. --volker roth
*/
dec = new DERDecoder(bais);
seq.decode(dec);
bais.close();
if (ca.isTrue()) {
/*