FileDocCategorySizeDatePackage
TBSRequest.javaAPI DocAndroid 1.5 API3970Wed May 06 22:41:06 BST 2009org.bouncycastle.asn1.ocsp

TBSRequest

public class TBSRequest extends org.bouncycastle.asn1.ASN1Encodable

Fields Summary
private static final org.bouncycastle.asn1.DERInteger
V1
org.bouncycastle.asn1.DERInteger
version
org.bouncycastle.asn1.x509.GeneralName
requestorName
org.bouncycastle.asn1.ASN1Sequence
requestList
org.bouncycastle.asn1.x509.X509Extensions
requestExtensions
Constructors Summary
public TBSRequest(org.bouncycastle.asn1.x509.GeneralName requestorName, org.bouncycastle.asn1.ASN1Sequence requestList, org.bouncycastle.asn1.x509.X509Extensions requestExtensions)


     
             
            
          
    
        this.version = V1;
        this.requestorName = requestorName;
        this.requestList = requestList;
        this.requestExtensions = requestExtensions;
    
public TBSRequest(org.bouncycastle.asn1.ASN1Sequence seq)

        int    index = 0;

        if (seq.getObjectAt(0) instanceof ASN1TaggedObject)
        {
            ASN1TaggedObject    o = (ASN1TaggedObject)seq.getObjectAt(0);

            if (o.getTagNo() == 0)
            {
                version = DERInteger.getInstance((ASN1TaggedObject)seq.getObjectAt(0), true);
                index++;
            }
            else
            {
                version = V1;
            }
        }
        else
        {
            version = V1;
        }

        if (seq.getObjectAt(index) instanceof ASN1TaggedObject)
        {
            requestorName = GeneralName.getInstance((ASN1TaggedObject)seq.getObjectAt(index++), true);
        }
        
        requestList = (ASN1Sequence)seq.getObjectAt(index++);

        if (seq.size() == (index + 1))
        {
            requestExtensions = X509Extensions.getInstance((ASN1TaggedObject)seq.getObjectAt(index), true);
        }
    
Methods Summary
public static org.bouncycastle.asn1.ocsp.TBSRequestgetInstance(org.bouncycastle.asn1.ASN1TaggedObject obj, boolean explicit)

        return getInstance(ASN1Sequence.getInstance(obj, explicit));
    
public static org.bouncycastle.asn1.ocsp.TBSRequestgetInstance(java.lang.Object obj)

        if (obj == null || obj instanceof TBSRequest)
        {
            return (TBSRequest)obj;
        }
        else if (obj instanceof ASN1Sequence)
        {
            return new TBSRequest((ASN1Sequence)obj);
        }

        throw new IllegalArgumentException("unknown object in factory");
    
public org.bouncycastle.asn1.x509.X509ExtensionsgetRequestExtensions()

        return requestExtensions;
    
public org.bouncycastle.asn1.ASN1SequencegetRequestList()

        return requestList;
    
public org.bouncycastle.asn1.x509.GeneralNamegetRequestorName()

        return requestorName;
    
public org.bouncycastle.asn1.DERIntegergetVersion()

        return version;
    
public org.bouncycastle.asn1.DERObjecttoASN1Object()
Produce an object suitable for an ASN1OutputStream.
TBSRequest ::= SEQUENCE {
version [0] EXPLICIT Version DEFAULT v1,
requestorName [1] EXPLICIT GeneralName OPTIONAL,
requestList SEQUENCE OF Request,
requestExtensions [2] EXPLICIT Extensions OPTIONAL }

        ASN1EncodableVector    v = new ASN1EncodableVector();

        //
        // if default don't include.
        //
        if (!version.equals(V1))
        {
            v.add(new DERTaggedObject(true, 0, version));
        }
        
        if (requestorName != null)
        {
            v.add(new DERTaggedObject(true, 1, requestorName));
        }

        v.add(requestList);

        if (requestExtensions != null)
        {
            v.add(new DERTaggedObject(true, 2, requestExtensions));
        }

        return new DERSequence(v);