public static TAG getTag(int value) {
   for (TAG tag : TAG.values()) {
     if (tag.value == value) {
       return tag;
     }
   }
   return null;
 }
 @Override
 public void parse(ASN1Primitive derObject) {
   ASN1Sequence derSequence = ASN1Object.getDERSequence(derObject);
   int total = derSequence.size();
   if (total > 0) {
     for (int i = 0; i < total; i++) {
       ASN1Primitive object = derSequence.getObjectAt(i).toASN1Primitive();
       if (object instanceof DERTaggedObject) {
         DERTaggedObject derTaggedObject = (DERTaggedObject) object;
         TAG tag = TAG.getTag(derTaggedObject.getTagNo());
         switch (tag) {
           case signerAlgorithmConstraints:
             this.signerAlgorithmConstraints = new AlgorithmConstraints();
             this.signerAlgorithmConstraints.parse(object);
             break;
           case eeCertAlgorithmConstraints:
             this.eeCertAlgorithmConstraints = new AlgorithmConstraints();
             this.eeCertAlgorithmConstraints.parse(object);
             break;
           case caCertAlgorithmConstraints:
             this.caCertAlgorithmConstraints = new AlgorithmConstraints();
             this.caCertAlgorithmConstraints.parse(object);
             break;
           case aaCertAlgorithmConstraints:
             this.aaCertAlgorithmConstraints = new AlgorithmConstraints();
             this.aaCertAlgorithmConstraints.parse(object);
             break;
           case tsaCertAlgorithmConstraints:
             this.tsaCertAlgorithmConstraints = new AlgorithmConstraints();
             this.tsaCertAlgorithmConstraints.parse(object);
             break;
           default:
             break;
         }
       }
     }
   }
 }