[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: asn1Decoding(1) fails to decode a CHOICE?
From: |
Nikos Mavrogiannopoulos |
Subject: |
Re: asn1Decoding(1) fails to decode a CHOICE? |
Date: |
Sat, 06 Oct 2012 16:17:58 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.6esrpre) Gecko/20120805 Icedove/10.0.6 |
On 10/06/2012 03:58 PM, Ivan Shmakov wrote:
> >> It seems like asn1Decoding(1) (as of 2.13 debian 2; though there
> >> don't seem to be any relevant entries in the log [1] in between 2.13
> >> and 2.14) fails to decode a CHOICE. Consider, e. g.:
> >> $ asn1Decoding \
> >> <(printf %s\\n \
> >> 'Example { } DEFINITIONS EXPLICIT TAGS ::=' \
> >> BEGIN \
> >> 'Foo ::= CHOICE { bar [0] INTEGER, baz [1] INTEGER }' \
> >> END) \
> >> <(printf '\x80\x01\x2a') \
> >> Example.Foo
> >> Parse: done.
> > Is the structure you have correct?
> If it's the input data that's meant here, then I presume so.
> I've generated it with Perl's Convert::ASN1 module, like:
> $ perl -we 'use strict;
> require Convert::ASN1;
> require IO::Handle;
> my $asn
> = Convert::ASN1->new ();
> $asn->prepare (q {
> Foo ::= CHOICE { bar [0] INTEGER, baz [1] INTEGER }
> })
> or die ();
> my $out
> = \*STDOUT;
> binmode ($out);
> my $enc
> = $asn->encode ({ qw (baz 42) })
> or die ($asn->error ());
> print $out ($enc);' \
> | od -t x1
> I haven't yet checked it against the specification.
> > Where is the actual integer stored?
> The integer is 42 decimal, or 2A hexadecimal, and it's stored as
> the third (and the last) octet of the sequence.
I don't see any integer there with "openssl asn1parse".
> > The asn1Coding tool is pretty primitive and needs a lot of changes to
> > be of any use.
> Perhaps it'd be simpler to implement a better tool on top of
> Perl's Convert::ASN1 instead…
Could be but I've never needed that tool. Maybe given its limitations it
is a good idea to even remove it. When I need to generate structures I
use libtasn1 directly.
regards,
Nikos
- asn1Decoding(1) fails to decode a CHOICE?, Ivan Shmakov, 2012/10/04
- Re: asn1Decoding(1) fails to decode a CHOICE?, Nikos Mavrogiannopoulos, 2012/10/06
- Re: asn1Decoding(1) fails to decode a CHOICE?, Ivan Shmakov, 2012/10/06
- Re: asn1Decoding(1) fails to decode a CHOICE?,
Nikos Mavrogiannopoulos <=
- Re: asn1Decoding(1) fails to decode a CHOICE?, Ivan Shmakov, 2012/10/06
- Re: asn1Decoding(1) fails to decode a CHOICE?, Nikos Mavrogiannopoulos, 2012/10/07
- Re: asn1Decoding(1) fails to decode a CHOICE?, Ivan Shmakov, 2012/10/07
- Re: asn1Decoding(1) fails to decode a CHOICE?, Nikos Mavrogiannopoulos, 2012/10/07
- PRIVATE tags handling, Ivan Shmakov, 2012/10/08
- [SOLVED] PRIVATE tags handling, Ivan Shmakov, 2012/10/08
asn1Coding(1) a CHOICE, Ivan Shmakov, 2012/10/08