Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.bouncycastle.asn1.x509;
  
The Holder object.

For an v2 attribute certificate this is:

            Holder ::= SEQUENCE {
                  baseCertificateID   [0] IssuerSerial OPTIONAL,
                           -- the issuer and serial number of
                           -- the holder's Public Key Certificate
                  entityName          [1] GeneralNames OPTIONAL,
                           -- the name of the claimant or role
                  objectDigestInfo    [2] ObjectDigestInfo OPTIONAL
                           -- used to directly authenticate the holder,
                           -- for example, an executable
            }
 

For an v1 attribute certificate this is:

         subject CHOICE {
          baseCertificateID [0] EXPLICIT IssuerSerial,
          -- associated with a Public Key Certificate
          subjectName [1] EXPLICIT GeneralNames },
          -- associated with a name
 
 
 public class Holder
     extends ASN1Object
 {
     public static final int V1_CERTIFICATE_HOLDER = 0;
     public static final int V2_CERTIFICATE_HOLDER = 1;
 
 
 
 
     private int version = ;
 
     public static Holder getInstance(Object obj)
     {
         if (obj instanceof Holder)
         {
             return (Holder)obj;
         }
         else if (obj instanceof ASN1TaggedObject)
         {
             return new Holder(ASN1TaggedObject.getInstance(obj));
         }
         else if (obj != null)
         {
             return new Holder(ASN1Sequence.getInstance(obj));
         }
 
         return null;
     }

    
Constructor for a holder for an V1 attribute certificate.

Parameters:
tagObj The ASN.1 tagged holder object.
 
     private Holder(ASN1TaggedObject tagObj)
     {
         switch (tagObj.getTagNo())
         {
         case 0:
              = IssuerSerial.getInstance(tagObjtrue);
             break;
         case 1:
              = GeneralNames.getInstance(tagObjtrue);
             break;
         default:
             throw new IllegalArgumentException("unknown tag in Holder");
         }
          = 0;
     }

    
Constructor for a holder for an V2 attribute certificate.

Parameters:
seq The ASN.1 sequence.
 
     private Holder(ASN1Sequence seq)
     {
        if (seq.size() > 3)
        {
            throw new IllegalArgumentException("Bad sequence size: "
                + seq.size());
        }
        for (int i = 0; i != seq.size(); i++)
        {
            ASN1TaggedObject tObj = ASN1TaggedObject.getInstance(seq
                .getObjectAt(i));
            switch (tObj.getTagNo())
            {
            case 0:
                 = IssuerSerial.getInstance(tObjfalse);
                break;
            case 1:
                 = GeneralNames.getInstance(tObjfalse);
                break;
            case 2:
                 = ObjectDigestInfo.getInstance(tObjfalse);
                break;
            default:
                throw new IllegalArgumentException("unknown tag in Holder");
            }
        }
         = 1;
    }
    public Holder(IssuerSerial baseCertificateID)
    {
        this(baseCertificateID);
    }

    
Constructs a holder from a IssuerSerial for a V1 or V2 certificate. .

Parameters:
baseCertificateID The IssuerSerial.
version The version of the attribute certificate.
    public Holder(IssuerSerial baseCertificateIDint version)
    {
        this. = baseCertificateID;
        this. = version;
    }
    
    
Returns 1 for V2 attribute certificates or 0 for V1 attribute certificates.

Returns:
The version of the attribute certificate.
    public int getVersion()
    {
        return ;
    }

    
Constructs a holder with an entityName for V2 attribute certificates.

Parameters:
entityName The entity or subject name.
    public Holder(GeneralNames entityName)
    {
        this(entityName);
    }

    
Constructs a holder with an entityName for V2 attribute certificates or with a subjectName for V1 attribute certificates.

Parameters:
entityName The entity or subject name.
version The version of the attribute certificate.
    public Holder(GeneralNames entityNameint version)
    {
        this. = entityName;
        this. = version;
    }
    
    
Constructs a holder from an object digest info.

Parameters:
objectDigestInfo The object digest info object.
    public Holder(ObjectDigestInfo objectDigestInfo)
    {
        this. = objectDigestInfo;
    }
    {
        return ;
    }

    
Returns the entityName for an V2 attribute certificate or the subjectName for an V1 attribute certificate.

Returns:
The entityname or subjectname.
    public GeneralNames getEntityName()
    {
        return ;
    }
    {
        return ;
    }
    {
        if ( == 1)
        {
            ASN1EncodableVector v = new ASN1EncodableVector();
            if ( != null)
            {
                v.add(new DERTaggedObject(false, 0, ));
            }
            if ( != null)
            {
                v.add(new DERTaggedObject(false, 1, ));
            }
            if ( != null)
            {
                v.add(new DERTaggedObject(false, 2, ));
            }
            return new DERSequence(v);
        }
        else
        {
            if ( != null)
            {
                return new DERTaggedObject(true, 1, );
            }
            else
            {
                return new DERTaggedObject(true, 0, );
            }
        }
    }
New to GrepCode? Check out our FAQ X