Hi Lev,

Thanks for the clarification. Also, could you just give an example of what
would the BER encoded stream look like, if instead of SIZE(1) we had a
SIZE(2) SEQUENCE OF ? I am confused on whether it should be:-

[6] {
  SEQUENCE {
  }
  SEQUENCE {
  }
}

Or be:-

[6] {
  SEQUENCE {
  }
}
[6] {
  SEQUENCE {
  }
}

Thanks,
bdutta

-----Original Message-----
From: Lev Walkin [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 14, 2005 11:27 PM
To: Banibrata Dutta
Cc: [email protected]
Subject: Re: [ASN1] BER encoding of

Banibrata Dutta wrote:

> Hi,
> 
> Could someone please verify that for the following ASN.1 definitions
> (snippet) :-
> 
>     contact [6] IMPLICIT SEQUENCE SIZE(1..5) OF SEQUENCE {
>             name  [0] IMPLICIT Name OPTIONAL,
>             url   [1] EXPLICIT Url OPTIONAL,
>             value [2] IMPLICIT INTEGER OPTIONAL,
>             delta [5] IMPLICIT INTEGER OPTIONAL
>         } OPTIONAL,
> 
> 
> Name ::= IA5String (SIZE(1..64))
> 
> Url ::= CHOICE {
>     myUrl       [0] IMPLICIT SEQUENCE {
>         user     [0] IMPLICIT IA5String (SIZE(1..16)) OPTIONAL,
>         host     [1] IMPLICIT IA5String (SIZE(1..64)) OPTIONAL,
>         port     [2] IMPLICIT INTEGER OPTIONAL,
>         transport   [3] IMPLICIT ENUMERATED {
>             udp(0),
>             tcp(1),
>         } OPTIONAL
>     }
> 
> Is the following BER encoding of "contact" field is correct ?
> 
>   [6] {
>     SEQUENCE {
>       [0] (72 65 73 70 6F 6E 73 65 4F 4B)
>       [2] (00)
>     }

Yes, this is correct. It translates to a value of the
following:

        contact [6] IMPLICIT SEQUENCE SIZE(1) OF SEQUENCE {
                name [0] IMPLICIT IA5String (SIZE(10)),
                value [2] IMPLICIT INTEGER (0)
        }

> and how about this ?
> 
> [6] {
>     SEQUENCE {
>       [1] {
>         [0] {
>           [1] (6C 61 76)
>           [2] (16 44)
>           [3] (00)
>         }
>       }
>       [1] {
>         [0] {
>           [1] (6C 61 76)
>           [2] (16 45)
>           [3] (01)
>         }
>       }
>     }
>   }

This one is not correct. There are two tags [1] inside the SEQUENCE (which
is inside the outer SEQUENCE OF), which is wrong.

--
Lev Walkin
[EMAIL PROTECTED]



_______________________________________________
ASN1 mailing list
[email protected]
http://lists.asn1.org/mailman/listinfo/asn1

Reply via email to