Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Convert::ASN1

by bibliophile (Parson)
on Jul 21, 2003 at 16:50 UTC ( #276352=perlquestion: print w/ replies, xml ) Need Help??
bibliophile has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks!

Has anyone here ever worked with the Convert::ASN1 module? I've run into something I don't quite understand....

I'm building a Biblio::ILL::ISO module to handle ISO 10161 interlibrary-loan protocol messages, which uses ASN.1 (and boy was I happy to find Convert::ASN1!).

My problem is with handling ASN.1 extensions (where the ASN.1 description is extended by pointing to other ASN.1 descriptions). Convert::ASN1 does have a mechanism for handling this - at least on the *encoding* side, but I can't seem to get things *decoding* properly (for protocol-based messages that happen to use one of these extensions).

I'm really hoping it's some minor thingy that I'm just not understanding....

Any help you could give would be... well... helpful. :-)

Comment on Convert::ASN1
Re: Convert::ASN1
by waswas-fng (Curate) on Jul 21, 2003 at 21:28 UTC
    Are you talking about using the find function? As I understand it you must use find to do nested defs. Could you show some code where you are able to do the encoding side so I can see if I am talking about the same thing here?

    -Waswas
      Hi Waswas,

      Here's a bit from my init routine (the ::desc package variables contain the ASN.1 descriptions; the _asn variables are class data (so I don't have to re-prepare the ASN.1 descriptions over and over) - I can send the whole module if you'd like):

      my $asn_ext = Convert::ASN1->new; $asn_ext->prepare( $Biblio::ILL::ISO::1_0_10161_13_3::desc ); # some error checking here, snipped for brevity $_asn = Convert::ASN1->new; $_asn->prepare( $Biblio::ILL::ISO::asn::desc ); # some error checking here, snipped for brevity $_asn_initialized = 1; # "1.0.10161.13.3" is what it *should* be, according to the ISO 10 +161 maintenance agency: #$_asn->registeroid("1.0.10161.13.3",$asn_ext->find("APDU-Delivery +-Info")); # "1" is what it *is*, by looking at a hex dump of the request rec +ord $_asn->registeroid("1",$asn_ext->find("APDU-Delivery-Info"));

      The encode routine:

      sub encode { my $self = shift; my $href = $self->as_asn(); # builds a Convert::ASN1-parsable hash my $asn = $_asn->find( 'ILL-Request' ) or warn $_asn->error; my $pdu = $asn->encode( $href ) or warn $asn->error; return $pdu; }

      And the decode routine:

      sub decode { my $self = shift; my $pdu = shift; my $asn = $_asn->find( 'ILL-Request' ) or warn $_asn->error; my $href = $asn->decode( $pdu ) or warn $asn->error; return $href; }

      I *think* the question is: How do I, in the middle of an 'ILL-Request' decode, tell it to find('APDU-Delivery-Info') when/if it encounters that extension code?

      Of course, I could be completely misunderstanding the way that Convert::ASN1 works. :-)

        Oops, that was me (bibliophile) - I forgot to log in, sigh.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://276352]
Approved by Paladin
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2014-08-21 09:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (128 votes), past polls