No this is not equivalent.
You have to encode/decode a BIT STRING with a content that is the result of the
encoding of K. For example, if the encoding rules
are BER and the tagging is EXPLICIT you must add the tag (3) of BIT STRING, the
length of the value (which is the length of the
encoding of K) and then the value (which is the encoding of K). There is a
simple BER example that supposes that K is an INTEGER to
make it simple :
Assuming K contains the value 5 : the encoding of K is 020105
Assuming that the value for a is 3 :
The encoding of your SEQUENCE is : 30 08 020103 0303020105
With your suggestion, you can see that you would encode : 30 06 020105 020105
and this wrong.
Actually as Lev suggested you can simply remove the CONTAINING keyword but you
must encode correctly the value inside the BIT
STRING. To do so, you have to encode K and use the result of this encoding as
the value of the BIT STRING. You have to do it
manually in your code (and the reverse action in decoding).
Bruno
________________________________
De : G Sethuraman [mailto:[EMAIL PROTECTED]
Envoyé : vendredi 7 juillet 2006 16:18
À : Bruno Konik; Olivier Dubuisson; [email protected]
Objet : Re: [ASN1] [Fwd: Re: Information regarding CONTAINING]
Hi Bruno,
Thanks for the reply and it really helpful.
In this case, there is no specific encoding rule mentioned for K.
So as you said, K shall be encoded with the same encoding rules as the
rest.
Then in this case, are these two equivalent ?
The original structure with CONTAINING
SEQUENCE {
a INTEGER
b BIT STRING (CONTAINING K) OPTIONAL
}
and the new structure without CONTAINING
SEQUENCE {
a INTEGER
b K OPTIONAL
}
Is this correct ? Will this lead to correct encoding and decoding ?
Thanks once again for your help
Regards
Sethuraman
-----------------------
[EMAIL PROTECTED]
-----------------------
----- Original Message ----
From: Bruno Konik <[EMAIL PROTECTED]>
To: Olivier Dubuisson <[EMAIL PROTECTED]>; [email protected]; [EMAIL
PROTECTED]
Sent: Friday, July 7, 2006 4:33:04 PM
Subject: RE: [ASN1] [Fwd: Re: Information regarding CONTAINING]
Hello,
The CONTAINING keyword simply means that the BIT STRING (and not
BIT_STRING :)) content is the result of the complete
encoding of
the type K. Since no encoding rules are specified here (there could be
with an ENCODED BY syntax) the encoding rules to be
used to
encode K are the same as those used to encode the BIT STRING. So the
process is simple :
1 - encode the type K with the encoding rules (as if it was a top-level
type)
2 - put the result of the encoding in the BIT STRING as its value
3 - encode the BIT STRING normally
Do the reverse in decoding of course.
The resources to be used are found in the spec X680 or X682 of the
ITU-T (see http://asn1.elibel.tm.fr/standards/).
I hope this will help you.
Bruno KONIK - uniGone
41-43 rue de Cronstadt
75015 PARIS
web : http://www.unigone.com
-- uniGone provides Java and c# tools for ASN.1 users, contact us for
more information --
> -----Message d'origine-----
> De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De
> la part de Olivier Dubuisson
> Envoyé : vendredi 7 juillet 2006 11:23
> À : [email protected]
> Cc : [EMAIL PROTECTED]
> Objet : [ASN1] [Fwd: Re: Information regarding CONTAINING]
>
> Can someone answer to this? I am attending ITU-T TSAG and
> have no time.
>
> -------- Original Message --------
> Subject: Re: Information regarding CONTAINING
> Date: Fri, 7 Jul 2006 01:51:18 -0700 (PDT)
> From: G Sethuraman <[EMAIL PROTECTED]>
> Reply-To: G Sethuraman <[EMAIL PROTECTED]>
> To: DUBUISSON Olivier RD-TCH <[EMAIL PROTECTED]>
>
>
>
> Hi Olivier,
>
> As per your direction, I have subscribed to asn1 mailing list
> but I am yet to get a cofirmation of my membership and hence
> not able to post the question to asn1 mailing list. Since I
> needed this information urgently, I am resending the question
> that I had sent you earlier. Can you throw some light on this ?
>
> I have a ASN1 file which has a CONTAINING keyword, but
> unfortunately the
> ASN1 compiler does not support this keyword. My question is,
> is it possible to bypass this keyword with a workaround so
> that I can use my existing ASN1 compiler ?
>
>
> My sample ASN1 file looks like this..
>
> SEQUENCE {
>
> a INTEGER
> b BIT_STRING (CONTAINING K) OPTIONAL
>
> }
>
> K ::= SEQUENCE {
> c INTEGER OPTIONAL,
> d SEQUENCE {} OPTIONAL
> }
>
> Can you also point me to some useful resources in this regard ?
>
> -----------------------
> [EMAIL PROTECTED]
> -----------------------
>
> Thanks for your time
>
> Regards
> Sethuraman G
>
> ----- Original Message ----
> From: Olivier Dubuisson <[EMAIL PROTECTED]>
> To: G Sethuraman <[EMAIL PROTECTED]>
> Sent: Wednesday, July 5, 2006 9:40:20 PM
> Subject: Re: Information regarding CONTAINING
>
> G Sethuraman wrote:
> > Hi,
> >
> > I have just started working on ASN1 and would like to get some
> > clarification regarding the CONTAINING keyword in ASN1.
>
> Please send your question to [email protected]
> --
> Olivier DUBUISSON
> France Telecom
> Pilotage de la normalisation/Deputy Director Standards
> Steering R&D/DD/NOR - BP 50702 - 22307 Lannion Cedex - France
> tel: +33 2 96 05 38 50 - fax: +33 2 96 05 10 08
>
>
>
>
> _______________________________________________
> ASN1 mailing list
> [email protected]
> http://lists.asn1.org/mailman/listinfo/asn1
> --------------------------------------------------------------
> -------------------------
> Orange vous informe que cet e-mail a ete controle par
> l'anti-virus mail.
> Aucun virus connu a ce jour par nos services n'a ete detecte.
>
>
>
_______________________________________________
ASN1 mailing list
[email protected]
http://lists.asn1.org/mailman/listinfo/asn1