Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.bouncycastle.asn1.x509;
  
  
 
 public class NameConstraints
     extends ASN1Object
 {
     private GeneralSubtree[] permittedexcluded;
 
     public static NameConstraints getInstance(Object obj)
     {
         if (obj instanceof NameConstraints)
         {
             return (NameConstraints)obj;
         }
         if (obj != null)
         {
             return new NameConstraints(ASN1Sequence.getInstance(obj));
         }
 
         return null;
     }
 
     private NameConstraints(ASN1Sequence seq)
     {
         Enumeration e = seq.getObjects();
         while (e.hasMoreElements())
         {
             ASN1TaggedObject o = ASN1TaggedObject.getInstance(e.nextElement());
             switch (o.getTagNo())
             {
                 case 0:
                      = createArray(ASN1Sequence.getInstance(ofalse));
                     break;
                 case 1:
                      = createArray(ASN1Sequence.getInstance(ofalse));
                     break;
             }
         }
     }

    
Constructor from a given details.

permitted and excluded are arrays of GeneralSubtree objects.

Parameters:
permitted Permitted subtrees
excluded Excludes subtrees
 
     public NameConstraints(
         GeneralSubtree[] permitted,
         GeneralSubtree[] excluded)
     {
         if (permitted != null)
         {
             this. = permitted;
         }
 
         if (excluded != null)
         {
             this. = excluded;
         }
     }
 
     private GeneralSubtree[] createArray(ASN1Sequence subtree)
     {
         GeneralSubtree[] ar = new GeneralSubtree[subtree.size()];
 
         for (int i = 0; i != ar.lengthi++)
         {
             ar[i] = GeneralSubtree.getInstance(subtree.getObjectAt(i));
         }
 
         return ar;
     }
 
     public GeneralSubtree[] getPermittedSubtrees()
     {
         return ;
     }
 
     public GeneralSubtree[] getExcludedSubtrees()
     {
         return ;
     }
 
     /*
      * NameConstraints ::= SEQUENCE { permittedSubtrees [0] GeneralSubtrees
     * OPTIONAL, excludedSubtrees [1] GeneralSubtrees OPTIONAL }
     */
    {
        ASN1EncodableVector v = new ASN1EncodableVector();
        if ( != null)
        {
            v.add(new DERTaggedObject(false, 0, new DERSequence()));
        }
        if ( != null)
        {
            v.add(new DERTaggedObject(false, 1, new DERSequence()));
        }
        return new DERSequence(v);
    }
New to GrepCode? Check out our FAQ X