Example usage for org.bouncycastle.asn1 DERSequence size

List of usage examples for org.bouncycastle.asn1 DERSequence size

Introduction

In this page you can find the example usage for org.bouncycastle.asn1 DERSequence size.

Prototype

public int size() 

Source Link

Document

Return the number of objects in this sequence.

Usage

From source file:be.fedict.eid.pkira.crypto.certificate.CertificateInfo.java

License:Open Source License

public List<String> getAlternativeNames() throws CryptoException {
    try {//  w w  w  .  j av a2 s.  com
        List<String> result = new ArrayList<String>();

        byte[] extensionBytes = certificate.getExtensionValue(X509Extension.subjectAlternativeName.getId());
        ASN1OctetString octs = (ASN1OctetString) ASN1Object.fromByteArray(extensionBytes);
        DERSequence extension = (DERSequence) ASN1Object.fromByteArray(octs.getOctets());

        for (int i = 0; i < extension.size(); i++) {
            GeneralName name = GeneralName.getInstance(extension.getObjectAt(i));
            if (name.getTagNo() == GeneralName.dNSName) {
                result.add(name.getName().toString());
            }
        }

        return result;
    } catch (IOException e) {
        throw new CryptoException("Could not extract SAN value.", e);
    }
}

From source file:bluecrystal.bcdeps.helper.DerEncoder.java

License:Open Source License

public static String extractHashId(byte[] sign) throws Exception {
    String ret = null;//from  w  w w  . j  a v  a 2  s. co m
    ASN1InputStream is = new ASN1InputStream(new ByteArrayInputStream(sign));
    ASN1Primitive topLevel = is.readObject();
    LOG.debug("top level:" + topLevel.getClass().getName());

    if (topLevel instanceof org.bouncycastle.asn1.DLSequence) {
        DLSequence topLevelDLS = (DLSequence) topLevel;
        if (topLevelDLS.size() == 2) {
            ASN1Encodable level1 = topLevelDLS.getObjectAt(1);
            LOG.debug("level1:" + level1.getClass().getName());
            if (level1 instanceof org.bouncycastle.asn1.DERTaggedObject) {
                DERTaggedObject level1TO = (DERTaggedObject) level1;
                ASN1Primitive level2 = level1TO.getObject();
                LOG.debug("level2:" + level2.getClass().getName());
                if (level2 instanceof org.bouncycastle.asn1.DERSequence) {
                    DERSequence level2DS = (DERSequence) level2;
                    LOG.debug("level2 len:" + level2DS.size());

                    ASN1Encodable level3_1 = level2DS.getObjectAt(1);
                    LOG.debug("level3_1:" + level3_1.getClass().getName());

                    if (level3_1 instanceof org.bouncycastle.asn1.DERSet) {
                        DERSet level3_1Set = (DERSet) level3_1;
                        ASN1Encodable level4_1 = level3_1Set.getObjectAt(0);
                        LOG.debug("level4_1:" + level4_1.getClass().getName());

                        if (level4_1 instanceof org.bouncycastle.asn1.DERSequence) {
                            DERSequence level4_1Seq = (DERSequence) level4_1;
                            ASN1Encodable level5_0 = level4_1Seq.getObjectAt(0);

                            LOG.debug("level5_0:" + level5_0.getClass().getName());

                            if (level5_0 instanceof org.bouncycastle.asn1.ASN1ObjectIdentifier) {
                                ASN1ObjectIdentifier level5_0Seq = (ASN1ObjectIdentifier) level5_0;
                                LOG.debug(level5_0Seq.toString());
                                ret = level5_0Seq.toString();

                            } else {
                                throw new Exception("DER enconding error");
                            }

                        } else {
                            throw new Exception("DER enconding error");
                        }

                    } else {
                        throw new Exception("DER enconding error");
                    }
                } else {
                    throw new Exception("DER enconding error");
                }

            } else {
                throw new Exception("DER enconding error");
            }
        } else {
            throw new Exception("DER enconding error");
        }

    } else {
        throw new Exception("DER enconding error");
    }

    return ret;
}

From source file:bluecrystal.bcdeps.helper.DerEncoder.java

License:Open Source License

public static byte[] extractSignature(byte[] sign) throws Exception {
    byte[] ret = null;
    ASN1InputStream is = new ASN1InputStream(new ByteArrayInputStream(sign));
    ASN1Primitive topLevel = is.readObject();
    LOG.debug("top level:" + topLevel.getClass().getName());

    if (topLevel instanceof org.bouncycastle.asn1.DLSequence) {
        DLSequence topLevelDLS = (DLSequence) topLevel;
        if (topLevelDLS.size() == 2) {
            ASN1Encodable level1 = topLevelDLS.getObjectAt(1);
            LOG.debug("level1:" + level1.getClass().getName());
            if (level1 instanceof org.bouncycastle.asn1.DERTaggedObject) {
                DERTaggedObject level1TO = (DERTaggedObject) level1;
                ASN1Primitive level2 = level1TO.getObject();
                LOG.debug("level2:" + level2.getClass().getName());
                if (level2 instanceof org.bouncycastle.asn1.DERSequence) {
                    DERSequence level2DS = (DERSequence) level2;
                    LOG.debug("level2 len:" + level2DS.size());
                    ASN1Encodable level3_4 = level2DS.getObjectAt(level2DS.size() - 1);
                    LOG.debug("level3_4:" + level3_4.getClass().getName());
                    if (level3_4 instanceof org.bouncycastle.asn1.DERSet) {
                        DERSet level3_4DS = (DERSet) level3_4;
                        ASN1Encodable level3_4_0 = level3_4DS.getObjectAt(0);
                        LOG.debug("level3_4_0:" + level3_4_0.getClass().getName());
                        if (level3_4_0 instanceof org.bouncycastle.asn1.DERSequence) {
                            DERSequence level3_4_0DS = (DERSequence) level3_4_0;
                            LOG.debug("level3_4_0DS len:" + level3_4_0DS.size());
                            ASN1Encodable signature = level3_4_0DS.getObjectAt(level3_4_0DS.size() - 1);
                            LOG.debug("signature:" + signature.getClass().getName());
                            if (signature instanceof org.bouncycastle.asn1.DEROctetString) {
                                DEROctetString signDOS = (DEROctetString) signature;
                                ret = signDOS.getOctets();
                            }/*from   w w  w  .  j  av a 2  s . co m*/
                        } else {
                            throw new Exception("DER enconding error");
                        }

                    } else {
                        throw new Exception("DER enconding error");
                    }
                } else {
                    throw new Exception("DER enconding error");
                }

            } else {
                throw new Exception("DER enconding error");
            }
        } else {
            throw new Exception("DER enconding error");
        }

    } else {
        throw new Exception("DER enconding error");
    }

    return ret;
}

From source file:bluecrystal.bcdeps.helper.DerEncoder.java

License:Open Source License

public static DERTaggedObject extractDTOSignPolicyOid(byte[] sign, SignCompare signCompare) throws Exception {

    DERTaggedObject ret = null;//from w  w w  .j  av  a 2 s  .c o m
    ASN1InputStream is = new ASN1InputStream(new ByteArrayInputStream(sign));
    ASN1Primitive topLevel = is.readObject();
    LOG.debug("top level:" + topLevel.getClass().getName());

    if (topLevel instanceof org.bouncycastle.asn1.DLSequence) {
        DLSequence topLevelDLS = (DLSequence) topLevel;
        if (topLevelDLS.size() == 2) {
            ASN1Encodable level1 = topLevelDLS.getObjectAt(1);
            LOG.debug("level1:" + level1.getClass().getName());
            if (level1 instanceof org.bouncycastle.asn1.DERTaggedObject) {
                DERTaggedObject level1TO = (DERTaggedObject) level1;
                ASN1Primitive level2 = level1TO.getObject();
                LOG.debug("level2:" + level2.getClass().getName());
                if (level2 instanceof org.bouncycastle.asn1.DERSequence) {
                    DERSequence level2DS = (DERSequence) level2;
                    LOG.debug("level2 len:" + level2DS.size());
                    signCompare.setNumCerts(extractCertCount(level2DS));
                    ret = extractSignedAttributes(level2DS);
                } else {
                    throw new Exception("DER enconding error");
                }

            } else {
                throw new Exception("DER enconding error");
            }
        } else {
            throw new Exception("DER enconding error");
        }

    } else {
        throw new Exception("DER enconding error");
    }

    return ret;
}

From source file:bluecrystal.bcdeps.helper.DerEncoder.java

License:Open Source License

public static void extractSignCompare2(byte[] sign, SignCompare2 signCompare) throws Exception {
    saveDebug(sign);/*from  w  ww.java  2s .  c  o m*/
    DERTaggedObject ret = null;
    ASN1InputStream is = new ASN1InputStream(new ByteArrayInputStream(sign));
    ASN1Primitive topLevel = is.readObject();
    LOG.debug("top level:" + topLevel.getClass().getName());

    if (topLevel instanceof org.bouncycastle.asn1.DLSequence) {
        DLSequence topLevelDLS = (DLSequence) topLevel;
        if (topLevelDLS.size() == 2) {
            ASN1Encodable level1 = topLevelDLS.getObjectAt(1);
            LOG.debug("level1:" + level1.getClass().getName());
            if (level1 instanceof org.bouncycastle.asn1.DERTaggedObject) {
                DERTaggedObject level1TO = (DERTaggedObject) level1;
                ASN1Primitive level2 = level1TO.getObject();
                LOG.debug("level2:" + level2.getClass().getName());
                if (level2 instanceof org.bouncycastle.asn1.DERSequence) {
                    DERSequence level2DS = (DERSequence) level2;
                    LOG.debug("level2 len:" + level2DS.size());
                    signCompare.setNumCerts(extractCertCount(level2DS));
                    ret = extractSignedAttributes(level2DS);
                } else {
                    throw new Exception("DER enconding error");
                }

            } else {
                throw new Exception("DER enconding error");
            }
        } else {
            throw new Exception("DER enconding error");
        }

    } else {
        throw new Exception("DER enconding error");
    }

    //      return ret;
}

From source file:bluecrystal.bcdeps.helper.DerEncoder.java

License:Open Source License

public static List<byte[]> extractCertList(byte[] sign) throws Exception {
    List<byte[]> ret = null;
    ASN1InputStream is = new ASN1InputStream(new ByteArrayInputStream(sign));
    ASN1Primitive topLevel = is.readObject();
    LOG.debug("top level:" + topLevel.getClass().getName());

    if (topLevel instanceof org.bouncycastle.asn1.DLSequence) {
        DLSequence topLevelDLS = (DLSequence) topLevel;
        if (topLevelDLS.size() == 2) {
            ASN1Encodable level1 = topLevelDLS.getObjectAt(1);
            LOG.debug("level1:" + level1.getClass().getName());
            if (level1 instanceof org.bouncycastle.asn1.DERTaggedObject) {
                DERTaggedObject level1TO = (DERTaggedObject) level1;
                ASN1Primitive level2 = level1TO.getObject();
                LOG.debug("level2:" + level2.getClass().getName());
                if (level2 instanceof org.bouncycastle.asn1.DERSequence) {
                    DERSequence level2DS = (DERSequence) level2;
                    LOG.debug("level2 len:" + level2DS.size());
                    ret = extractCertArray(level2DS);
                } else {
                    throw new Exception("DER enconding error");
                }/*w w  w. ja va2s .  c om*/

            } else {
                throw new Exception("DER enconding error");
            }
        } else {
            throw new Exception("DER enconding error");
        }

    } else {
        throw new Exception("DER enconding error");
    }

    return ret;
}

From source file:bluecrystal.bcdeps.helper.DerEncoder.java

License:Open Source License

public static int extractCertCount(DERSequence certTree) {
    ASN1Encodable level0 = getAt(certTree, 3);
    if (level0 instanceof DERTaggedObject) {
        DERTaggedObject level0Tag = (DERTaggedObject) level0;
        ASN1Encodable level0Obj = level0Tag.getObject();
        if (level0Obj instanceof DERSequence) {
            DERSequence level0Seq = (DERSequence) level0Obj;
            return 1;
        } else if (level0Obj instanceof DLSequence) {
            DLSequence level0Seq = (DLSequence) level0Obj;
            return level0Seq.size();
        }//from w w  w.j a  v  a 2s . c  o m
    }
    return certTree.size();
}

From source file:bluecrystal.bcdeps.helper.DerEncoder.java

License:Open Source License

public static List<byte[]> extractCertArray(DERSequence certTree) {
    List<byte[]> ret = new ArrayList<byte[]>();

    ASN1Encodable level0 = getAt(certTree, 3);
    if (level0 instanceof DERTaggedObject) {
        DERTaggedObject level0Tag = (DERTaggedObject) level0;
        ASN1Encodable level0Obj = level0Tag.getObject();
        if (level0Obj instanceof DERSequence) {
            try {
                DERSequence level0Seq = (DERSequence) level0Obj;
                if (level0Seq.getObjectAt(2) instanceof DERBitString) {
                    // achei o certificado
                    byte[] b = level0Seq.getEncoded();
                    ret.add(b);// w  w w .ja  v  a2  s  .  co  m
                } else {
                    for (int i = 0; i < level0Seq.size(); i++) {

                        ASN1Encodable objNdx = level0Seq.getObjectAt(i);
                        if (objNdx instanceof DERSequence) {
                            try {
                                DERSequence objNdx2 = (DERSequence) objNdx;
                                byte[] b = objNdx2.getEncoded();
                                ret.add(b);
                            } catch (IOException e) {
                                LOG.error("DER decoding error", e);
                            }
                        }
                    }

                }
            } catch (IOException e) {
                LOG.error("DER decoding error", e);
            }
        } else if (level0Obj instanceof ASN1Sequence) {
            ASN1Sequence level0Seq = (ASN1Sequence) level0Obj;

            for (int i = 0; i < level0Seq.size(); i++) {

                ASN1Encodable objNdx = level0Seq.getObjectAt(i);
                if (objNdx instanceof DERSequence) {
                    try {
                        DERSequence objNdx2 = (DERSequence) objNdx;
                        byte[] b = objNdx2.getEncoded();
                        ret.add(b);
                    } catch (IOException e) {
                        LOG.error("DER decoding error", e);
                    }
                }
            }
        }
    }
    return ret;
}

From source file:bluecrystal.bcdeps.helper.DerEncoder.java

License:Open Source License

public static DERTaggedObject extractSignedAttributes(DERSequence level2DS) throws Exception {
    DERTaggedObject ret = null;/*  www  .j a va  2 s  .  com*/

    ASN1Encodable level3_4 = level2DS.getObjectAt(level2DS.size() - 1);
    LOG.debug("level3_4:" + level3_4.getClass().getName());
    if (level3_4 instanceof org.bouncycastle.asn1.DERSet) {
        DERSet level3_4DS = (DERSet) level3_4;
        ASN1Encodable level3_4_0 = level3_4DS.getObjectAt(0);
        LOG.debug("level3_4_0:" + level3_4_0.getClass().getName());
        if (level3_4_0 instanceof org.bouncycastle.asn1.DERSequence) {
            DERSequence level3_4_0DS = (DERSequence) level3_4_0;
            LOG.debug("level3_4_0DS len:" + level3_4_0DS.size());
            ASN1Encodable signedAttribs = level3_4_0DS.getObjectAt(3);
            LOG.debug("signature:" + signedAttribs.getClass().getName());
            if (signedAttribs instanceof org.bouncycastle.asn1.DERTaggedObject) {
                DERTaggedObject signedAttribsDTO = (DERTaggedObject) signedAttribs;
                ret = signedAttribsDTO;

                // trata busca da Policy OID
            } else if (signedAttribs instanceof org.bouncycastle.asn1.DERSequence) {
                ret = null;
            } else {
                throw new Exception("DER enconding error");
            }
        } else {
            throw new Exception("DER enconding error");
        }

    } else {
        throw new Exception("DER enconding error");
    }
    return ret;
}

From source file:bluecrystal.bcdeps.helper.DerEncoder.java

License:Open Source License

public static SignPolicyRef extractVerifyRefence(byte[] policy) throws IOException, ParseException {
    SignPolicyRef ret = new SignPolicyRef();

    ASN1InputStream is = new ASN1InputStream(new ByteArrayInputStream(policy));
    ASN1Primitive topLevel = is.readObject();
    // SignaturePolicy ::= SEQUENCE {
    // signPolicyHashAlg AlgorithmIdentifier,
    // signPolicyInfo SignPolicyInfo,
    // signPolicyHash SignPolicyHash OPTIONAL }
    if (topLevel instanceof DLSequence) {
        DLSequence topLevelDLS = (DLSequence) topLevel;
        ASN1Encodable dseqL10 = topLevelDLS.getObjectAt(0);
        ASN1Encodable psHashAlg = null;// w ww .  j a va 2 s.  c o m
        if (dseqL10 instanceof DLSequence) {
            DLSequence dseqL10DLS = (DLSequence) dseqL10;
            psHashAlg = dseqL10DLS.getObjectAt(0);

        } else if (dseqL10 instanceof ASN1ObjectIdentifier) {
            psHashAlg = (ASN1ObjectIdentifier) dseqL10;
        } else
            return null;

        if (psHashAlg instanceof ASN1ObjectIdentifier) {
            ASN1ObjectIdentifier psHashAlgOid = (ASN1ObjectIdentifier) psHashAlg;
            ret.setPsHashAlg(psHashAlgOid.toString());
        }

        ASN1Encodable dseqL11 = topLevelDLS.getObjectAt(1);
        if (dseqL11 instanceof DLSequence) {
            // SignPolicyInfo ::= SEQUENCE {
            DLSequence dseqL11DLS = (DLSequence) dseqL11;
            ASN1Encodable psOid = dseqL11DLS.getObjectAt(0);
            // signPolicyIdentifier SignPolicyId,
            // 2.16.76.1.7.1.6.2.1
            if (psOid instanceof ASN1ObjectIdentifier) {
                ASN1ObjectIdentifier psOidOid = (ASN1ObjectIdentifier) psOid;
                ret.setPsOid(psOidOid.toString());

            }
            ASN1Encodable dateOfIssue = dseqL11DLS.getObjectAt(1);
            // dateOfIssue GeneralizedTime,
            // 2012-03-22
            if (dateOfIssue instanceof ASN1GeneralizedTime) {
                ASN1GeneralizedTime dateOfIssueGT = (ASN1GeneralizedTime) dateOfIssue;
                ret.setDateOfIssue(dateOfIssueGT.getDate());
            }

            ASN1Encodable policyIssuerName = dseqL11DLS.getObjectAt(2);
            // policyIssuerName PolicyIssuerName,
            // C=BR, O=ICP-Brasil, OU=Instituto Nacional de Tecnologia da
            // Informacao
            // - ITI
            if (policyIssuerName instanceof DLSequence) {
                DLSequence policyIssuerNameDLSeq = (DLSequence) policyIssuerName;
                ASN1Encodable policyIssuerName2 = policyIssuerNameDLSeq.getObjectAt(0);
                if (policyIssuerName2 instanceof DERTaggedObject) {
                    DERTaggedObject policyIssuerName2DTO = (DERTaggedObject) policyIssuerName2;
                    ASN1Primitive polIssuerNameObj = policyIssuerName2DTO.getObject();
                    if (polIssuerNameObj instanceof DEROctetString) {
                        String polIssuerNameStr = new String(((DEROctetString) polIssuerNameObj).getOctets());
                        ret.setPolIssuerName(polIssuerNameStr);
                    }
                }

            }

            ASN1Encodable fieldOfApplication = dseqL11DLS.getObjectAt(3);
            // fieldOfApplication FieldOfApplication,
            // Este tipo de assinatura deve ser utilizado em aplicacoes ou
            // processos
            // de negocio nos quais a assinatura digital agrega seguranca a
            // autenticacao de entidades e verificacao de integridade,
            // permitindo
            // sua validacao durante o prazo de, validade dos certificados
            // dos
            // signatarios. Uma vez que nao sao usados carimbos do tempo, a
            // validacao posterior so sera possivel se existirem referencias
            // temporais que identifiquem o momento em que ocorreu a
            // assinatura
            // digital. Nessas situacoes, deve existir legislacao especifica
            // ou um
            // acordo previo entre as partes definindo as referencias a
            // serem
            // utilizadas. Segundo esta PA, e permitido o emprego de
            // multiplas
            // assinaturas.
            if (fieldOfApplication instanceof DEROctetString) {
                DERUTF8String fieldOfApplicationDUS = (DERUTF8String) fieldOfApplication;
                ret.setFieldOfApplication(fieldOfApplicationDUS.getString());
            }
            // signatureValidationPolicy SignatureValidationPolicy,
            // signPolExtensions SignPolExtensions OPTIONAL
            // SignatureValidationPolicy ::= SEQUENCE {
            ASN1Encodable signatureValidationPolicy = dseqL11DLS.getObjectAt(4);
            if (signatureValidationPolicy instanceof DLSequence) {
                DLSequence signatureValidationPolicyDLS = (DLSequence) signatureValidationPolicy;
                // signingPeriod SigningPeriod,
                // NotBefore 2012-03-22
                // NotAfter 2023-06-21
                ASN1Encodable signingPeriod = signatureValidationPolicyDLS.getObjectAt(0);
                if (signingPeriod instanceof DLSequence) {
                    DLSequence signingPeriodDLS = (DLSequence) signingPeriod;
                    ASN1Encodable notBefore = signingPeriodDLS.getObjectAt(0);
                    if (notBefore instanceof ASN1GeneralizedTime) {
                        ASN1GeneralizedTime notBeforeAGT = (ASN1GeneralizedTime) notBefore;
                        ret.setNotBefore(notBeforeAGT.getDate());

                    }

                    ASN1Encodable notAfter = signingPeriodDLS.getObjectAt(1);
                    if (notAfter instanceof ASN1GeneralizedTime) {
                        ASN1GeneralizedTime notAfterAGT = (ASN1GeneralizedTime) notAfter;
                        ret.setNotAfter(notAfterAGT.getDate());
                    }

                }

                //
                // commonRules CommonRules,
                ASN1Encodable commonRules = getAt(signatureValidationPolicyDLS, 1);
                if (commonRules instanceof DLSequence) {
                    DLSequence commonRulesDLS = (DLSequence) commonRules;
                    // CommonRules ::= SEQUENCE {
                    // signerAndVeriferRules [0] SignerAndVerifierRules
                    // OPTIONAL,
                    // signingCertTrustCondition [1]
                    // SigningCertTrustCondition OPTIONAL,
                    // timeStampTrustCondition [2] TimestampTrustCondition
                    // OPTIONAL,
                    // attributeTrustCondition [3] AttributeTrustCondition
                    // OPTIONAL,
                    // algorithmConstraintSet [4] AlgorithmConstraintSet
                    // OPTIONAL,
                    // signPolExtensions [5] SignPolExtensions OPTIONAL
                    // }
                    ASN1Encodable signerAndVeriferRules = getAt(commonRulesDLS, 0);

                    // SignerAndVerifierRules ::= SEQUENCE {
                    // signerRules SignerRules,
                    // verifierRules VerifierRules }

                    if (signerAndVeriferRules instanceof DERTaggedObject) {
                        DERTaggedObject signerAndVeriferRulesDTO = (DERTaggedObject) signerAndVeriferRules;
                        ASN1Encodable signerAndVeriferRulesTmp = signerAndVeriferRulesDTO.getObject();
                        if (signerAndVeriferRulesTmp instanceof DERSequence) {
                            DERSequence signerAndVeriferRulesDERSeq = (DERSequence) signerAndVeriferRulesTmp;
                            ASN1Encodable signerRules = getAt(signerAndVeriferRulesDERSeq, 0);
                            if (signerRules instanceof DERSequence) {
                                DERSequence signerRulesDERSeq = (DERSequence) signerRules;
                                // SignerRules ::= SEQUENCE {
                                // externalSignedData BOOLEAN OPTIONAL,
                                // -- True if signed data is external to CMS
                                // structure
                                // -- False if signed data part of CMS
                                // structure
                                // -- not present if either allowed
                                // mandatedSignedAttr CMSAttrs,
                                // -- Mandated CMS signed attributes
                                // 1.2.840.113549.1.9.3
                                // 1.2.840.113549.1.9.4
                                // 1.2.840.113549.1.9.16.2.15
                                // 1.2.840.113549.1.9.16.2.47
                                // mandatedUnsignedAttr CMSAttrs,
                                // <empty sequence>
                                // -- Mandated CMS unsigned attributed
                                // mandatedCertificateRef [0] CertRefReq
                                // DEFAULT signerOnly,
                                // (1)
                                // -- Mandated Certificate Reference
                                // mandatedCertificateInfo [1] CertInfoReq
                                // DEFAULT none,
                                // -- Mandated Certificate Info
                                // signPolExtensions [2] SignPolExtensions
                                // OPTIONAL}

                                // CMSAttrs ::= SEQUENCE OF OBJECT
                                // IDENTIFIER
                                ASN1Encodable mandatedSignedAttr = getAt(signerRulesDERSeq, 0);
                                if (mandatedSignedAttr instanceof DERSequence) {
                                    DERSequence mandatedSignedAttrDERSeq = (DERSequence) mandatedSignedAttr;
                                    for (int i = 0; i < mandatedSignedAttrDERSeq.size(); i++) {
                                        ASN1Encodable at = getAt(mandatedSignedAttrDERSeq, i);
                                        ret.addMandatedSignedAttr(at.toString());
                                    }
                                }
                                ASN1Encodable mandatedUnsignedAttr = getAt(signerRulesDERSeq, 1);
                                if (mandatedUnsignedAttr instanceof DERSequence) {
                                    DERSequence mandatedUnsignedAttrDERSeq = (DERSequence) mandatedUnsignedAttr;
                                }
                                ASN1Encodable mandatedCertificateRef = getAt(signerRulesDERSeq, 2);
                                if (mandatedCertificateRef instanceof DERTaggedObject) {
                                    DERTaggedObject mandatedCertificateRefDERSeq = (DERTaggedObject) mandatedCertificateRef;
                                    // CertRefReq ::= ENUMERATED {
                                    // signerOnly (1),
                                    // -- Only reference to signer cert
                                    // mandated
                                    // fullpath (2)
                                    //
                                    // -- References for full cert path up
                                    // to a trust point required
                                    // }
                                    ASN1Encodable mandatedCertificateRefTmp = mandatedCertificateRefDERSeq
                                            .getObject();
                                    ASN1Enumerated mandatedCertificateRefEnum = (ASN1Enumerated) mandatedCertificateRefTmp;
                                    BigInteger valEnum = mandatedCertificateRefEnum.getValue();
                                    int mandatedCertificateRefInt = valEnum.intValue();
                                    ret.setMandatedCertificateRef(mandatedCertificateRefInt);
                                    int x = 0;
                                }
                            }

                            ASN1Encodable verifierRules = getAt(signerAndVeriferRulesDERSeq, 1);
                            if (verifierRules instanceof DERSequence) {
                                DERSequence verifierRulesDERSeq = (DERSequence) verifierRules;

                            }

                        }

                    }

                    ASN1Encodable signingCertTrustCondition = getAt(commonRulesDLS, 1);
                    if (signingCertTrustCondition instanceof DERTaggedObject) {
                        DERTaggedObject signingCertTrustConditionDTO = (DERTaggedObject) signingCertTrustCondition;
                        ASN1Encodable signingCertTrustConditionTmp = signingCertTrustConditionDTO.getObject();
                        if (signingCertTrustConditionTmp instanceof DERSequence) {
                            DERSequence signingCertTrustConditionDERSeq = (DERSequence) signingCertTrustConditionTmp;
                        }

                    }
                    ASN1Encodable timeStampTrustCondition = getAt(commonRulesDLS, 2);
                    if (timeStampTrustCondition instanceof DERTaggedObject) {
                        DERTaggedObject timeStampTrustConditionDTO = (DERTaggedObject) timeStampTrustCondition;
                        ASN1Encodable timeStampTrustConditionTmp = timeStampTrustConditionDTO.getObject();
                        if (timeStampTrustConditionTmp instanceof DERSequence) {
                            DERSequence timeStampTrustConditionDERSeq = (DERSequence) timeStampTrustConditionTmp;
                        }

                    }
                    ASN1Encodable attributeTrustCondition = getAt(commonRulesDLS, 3);
                    if (attributeTrustCondition instanceof DERTaggedObject) {
                        DERTaggedObject attributeTrustConditionDTO = (DERTaggedObject) attributeTrustCondition;
                        ASN1Encodable attributeTrustConditionTmp = attributeTrustConditionDTO.getObject();
                        if (attributeTrustConditionTmp instanceof DERSequence) {
                            DERSequence attributeTrustConditionDERSeq = (DERSequence) attributeTrustConditionTmp;
                        }

                    }

                    // *****************************
                    ASN1Encodable algorithmConstraintSet = getAt(commonRulesDLS, 4);
                    ASN1Encodable signPolExtensions = getAt(commonRulesDLS, 5);

                }
                // commitmentRules CommitmentRules,
                ASN1Encodable commitmentRules = getAt(signatureValidationPolicyDLS, 2);
                if (commitmentRules instanceof DLSequence) {

                }

                // signPolExtensions SignPolExtensions
                // OPTIONAL
                ASN1Encodable signPolExtensions = getAt(signatureValidationPolicyDLS, 3);
                if (signPolExtensions instanceof DLSequence) {

                }
                // }
            }
        }

    }

    // CertInfoReq ::= ENUMERATED {
    // none (0) ,
    // -- No mandatory requirements
    // signerOnly (1) ,
    // -- Only reference to signer cert mandated
    // fullpath (2)
    // -- References for full cert path up to a
    // -- trust point mandated
    // }

    is.close();
    return ret;

}