FileDocCategorySizeDatePackage
TimeStampReq.javaAPI DocAndroid 1.5 API4703Wed May 06 22:41:06 BST 2009org.bouncycastle.asn1.tsp

TimeStampReq

public class TimeStampReq extends org.bouncycastle.asn1.ASN1Encodable

Fields Summary
org.bouncycastle.asn1.DERInteger
version
MessageImprint
messageImprint
org.bouncycastle.asn1.DERObjectIdentifier
tsaPolicy
org.bouncycastle.asn1.DERInteger
nonce
org.bouncycastle.asn1.DERBoolean
certReq
org.bouncycastle.asn1.x509.X509Extensions
extensions
Constructors Summary
public TimeStampReq(org.bouncycastle.asn1.ASN1Sequence seq)

        int nbObjects = seq.size();

        int seqStart = 0;

        // version
        version = DERInteger.getInstance(seq.getObjectAt(seqStart));

        seqStart++;

        // messageImprint
        messageImprint = MessageImprint.getInstance(seq.getObjectAt(seqStart));

        seqStart++;

        for (int opt = seqStart; opt < nbObjects; opt++)
        {
            // tsaPolicy
            if (seq.getObjectAt(opt) instanceof DERObjectIdentifier)
            {
                tsaPolicy = DERObjectIdentifier.getInstance(seq.getObjectAt(opt));
            }
            // nonce
            else if (seq.getObjectAt(opt) instanceof DERInteger)
            {
                nonce = DERInteger.getInstance(seq.getObjectAt(opt));
            }
            // certReq
            else if (seq.getObjectAt(opt) instanceof DERBoolean)
            {
                certReq = DERBoolean.getInstance(seq.getObjectAt(opt));
            }
            // extensions
            else if (seq.getObjectAt(opt) instanceof ASN1TaggedObject)
            {
                ASN1TaggedObject    tagged = (ASN1TaggedObject)seq.getObjectAt(opt);
                if (tagged.getTagNo() == 0)
                {
                    extensions = X509Extensions.getInstance(tagged, false);
                }
            }
        }
    
public TimeStampReq(MessageImprint messageImprint, org.bouncycastle.asn1.DERObjectIdentifier tsaPolicy, org.bouncycastle.asn1.DERInteger nonce, org.bouncycastle.asn1.DERBoolean certReq, org.bouncycastle.asn1.x509.X509Extensions extensions)

        // default
        version = new DERInteger(1);

        this.messageImprint = messageImprint;
        this.tsaPolicy = tsaPolicy;
        this.nonce = nonce;
        this.certReq = certReq;
        this.extensions = extensions;
    
Methods Summary
public org.bouncycastle.asn1.DERBooleangetCertReq()

        return certReq;
    
public org.bouncycastle.asn1.x509.X509ExtensionsgetExtensions()

        return extensions;
    
public static org.bouncycastle.asn1.tsp.TimeStampReqgetInstance(java.lang.Object o)

        if (o == null || o instanceof TimeStampReq)
        {
            return (TimeStampReq) o;
        }
        else if (o instanceof ASN1Sequence)
        {
            return new TimeStampReq((ASN1Sequence) o);
        }

        throw new IllegalArgumentException(
                "Unknown object in 'TimeStampReq' factory : "
                        + o.getClass().getName() + ".");
    
public MessageImprintgetMessageImprint()

        return messageImprint;
    
public org.bouncycastle.asn1.DERIntegergetNonce()

        return nonce;
    
public org.bouncycastle.asn1.DERObjectIdentifiergetReqPolicy()

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

        return version;
    
public org.bouncycastle.asn1.DERObjecttoASN1Object()
TimeStampReq ::= SEQUENCE {
version INTEGER { v1(1) },
messageImprint MessageImprint,
--a hash algorithm OID and the hash value of the data to be
--time-stamped
reqPolicy TSAPolicyId OPTIONAL,
nonce INTEGER OPTIONAL,
certReq BOOLEAN DEFAULT FALSE,
extensions [0] IMPLICIT Extensions OPTIONAL
}

        ASN1EncodableVector v = new ASN1EncodableVector();
        
        v.add(version);
        v.add(messageImprint);
        
        if (tsaPolicy != null)
        {
            v.add(tsaPolicy);
        }
        
        if (nonce != null)
        {
            v.add(nonce);
        }
        
        if (certReq != null && certReq.isTrue())
        {
            v.add(certReq);
        }
        
        if (extensions != null)
        {
            v.add(new DERTaggedObject(false, 0, extensions));
        }

        return new DERSequence(v);