Encoding in case you are using BER rule is TLV format i.e. Tag Length Value format and each member of the sequence (KRN-SAFE-BODY) is assigned a unique Tag. This Tag value helps in recognizing which member is it. ----- Original Message ----- From: "Gustavo V. G. C. Rios" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 29, 2003 6:58 AM Subject: [ASN.1] (I AM DESPERATE, PLEASE) Beginner Question: ASN1 & Kerberos (rfc1510.txt)
> Dear gentleman, > > i am beginning studying ASN as an requirement for understanding kerberV > security protocol. One of its message specification is the following: > > KRB-SAFE-BODY ::= [APPLICATION 20] SEQUENCE { > user-data[0] OCTET STRING, > timestamp[1] KerberosTime OPTIONAL, > usec[2] INTEGER OPTIONAL, > seq-number[3] INTEGER OPTIONAL, > s-address[4] HostAddress, > r-address[5] HostAddress OPTIONAL > } > > My doubt regards with the decoding of the input stream. For the usec and > seq-number values i have three possible scenarios: > > 0) The two values are present, > 1) None of them are present, > 2) Just one of them is present. > > Since both are optional and have the same type, for scenario 2, how will > i *correctly* decode an input stream? I.e. , the next value to be decode > is an integer, but will i see it as the usec or the seq-number value?