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. 

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.
-- 
Dr Stephen N. Henson.   http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED] 
Senior crypto engineer, Gemplus: http://www.gemplus.com/
Core developer of the   OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to