[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [iaik-jce] ASN1 SEQUENCE



  public void decode(InputStream inputstream) throws CodingException,
IOException {
   this_object = ((DerInputStream)inputstream).readSequence();

     while(this_object.nextIsContextSpecific()) {
    int con_tag = this_object.nextTag();
    switch(con_tag) {
    case 2: //int nonce
     this_object.readContextSpecific(DerInputStream.INTEGER);
     nonce = ((BigInteger)this_object.readInteger()).intValue();
     break;
    case 3: //DigestInfo msg

this_object.readContextSpecific(DerInputStream.CONSTRUCTED|DerInputStream.SEQUENCE);

     msg = new DigestInfo(DerCoder.decode(this_object));
     break;
    case 4: //int sn
     this_object.readContextSpecific(DerInputStream.INTEGER);
     sn  = ((BigInteger)this_object.readInteger()).intValue();
     break;
    case 5: //byte[] freedata
     this_object.readContextSpecific(DerInputStream.OCTET_STRING);
     freedata = this_object.readOctetStringByteArray();
     break;
    }
   }

Catalin wrote:

> HelloI'm trying to use ASN1 SEQUENCE type. My question is: how do I
> set a component as OPTIONAL? And how do I set DEFAULT? Catalin

--
Mailinglist-archive at http://jcewww.iaik.at/mailarchive/iaik-jce/jcethreads.html

To unsubscribe send an email to listserv@iaik.at with the folowing content: UNSUBSCRIBE iaik-jce