On Thu, 7 Mar 2002, Dr S N Henson wrote:

> Vadim Fedukovich wrote:
> >
> > Hello,
> >
> > would this construct
> >
> > ASN1_SEQUENCE(SomeTypeDefinition) = {
> >   ASN1_IMP(, someFieldName, ASN1_FBOOLEAN, N)
> >
> > be fine for "someFieldName [N] BOOLEAN DEFAULT FALSE" in ASN.1?
> > Should one use ASN1_IMP_OPT() instead?
> >
>
> You should always use OPT with the ASN1_FBOOLEAN and ASN1_TBOOLEAN.
>
> The actual type is just applying a specific interpretation when the
> field is absent or taking the default value. For example in the
> ASN1_FBOOLEAN case it means that if the boolean value is set to FALSE it
> will not be encoded and if the field is absent it will be represented as
> FALSE.

Yes, this is exactly what I'm looking for

> You don't have to use the ASN1_FBOOLEAN and ASN1_TBOOLEAN types as long
> as you interpret and set the value appropriately.
>
> Using them does have a disadvantage in that some encoders might
> incorrectly not omit a field having the default value. This would mean
> that decoding and reencoding the structure would not produce the same
> result.
>
> Steve.

many thanx for advise and for powerful ASN1 code,
Vadim

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to