Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.bouncycastle.asn1.x509;
  
Target structure used in target information extension for attribute certificates from RFC 3281.
     Target  ::= CHOICE {
       targetName          [0] GeneralName,
       targetGroup         [1] GeneralName,
       targetCert          [2] TargetCert
     }
 

The targetCert field is currently not supported and must not be used according to RFC 3281.

 
 public class Target
     extends ASN1Object
     implements ASN1Choice
 {
     public static final int targetName = 0;
     public static final int targetGroup = 1;
 
     private GeneralName targName;
     private GeneralName targGroup;

    
Creates an instance of a Target from the given object.

obj can be a Target or a org.bouncycastle.asn1.ASN1TaggedObject

Parameters:
obj The object.
Returns:
A Target instance.
Throws:
java.lang.IllegalArgumentException if the given object cannot be interpreted as Target.
 
     public static Target getInstance(Object obj)
     {
         if (obj == null || obj instanceof Target)
         {
             return (Targetobj;
         }
         else if (obj instanceof ASN1TaggedObject)
         {
             return new Target((ASN1TaggedObject)obj);
         }
 
         throw new IllegalArgumentException("unknown object in factory: "
             + obj.getClass());
     }

    
Constructor from ASN1TaggedObject.

Parameters:
tagObj The tagged object.
Throws:
java.lang.IllegalArgumentException if the encoding is wrong.
 
     private Target(ASN1TaggedObject tagObj)
     {
         switch (tagObj.getTagNo())
         {
         case :     // GeneralName is already a choice so explicit
              = GeneralName.getInstance(tagObjtrue);
             break;
         case :
              = GeneralName.getInstance(tagObjtrue);
             break;
         default:
             throw new IllegalArgumentException("unknown tag: " + tagObj.getTagNo());
         }
     }

    
Constructor from given details.

Exactly one of the parameters must be not null.

Parameters:
type the choice type to apply to the name.
name the general name.
Throws:
java.lang.IllegalArgumentException if type is invalid.
 
     public Target(int typeGeneralName name)
     {
         this(new DERTaggedObject(typename));
     }

    

Returns:
Returns the targetGroup.
 
     public GeneralName getTargetGroup()
     {
        return ;
    }

    

Returns:
Returns the targetName.
    public GeneralName getTargetName()
    {
        return ;
    }

    
Produce an object suitable for an ASN1OutputStream. Returns:
     Target  ::= CHOICE {
       targetName          [0] GeneralName,
       targetGroup         [1] GeneralName,
       targetCert          [2] TargetCert
     }
 

Returns:
a ASN1Primitive
    {
        // GeneralName is a choice already so most be explicitly tagged
        if ( != null)
        {
            return new DERTaggedObject(true, 0, );
        }
        else
        {
            return new DERTaggedObject(true, 1, );
        }
    }
New to GrepCode? Check out our FAQ X