santosh_vjit has asked for the wisdom of the Perl Monks concerning the following question:
I have requirement to encode the below sequence structure with values to uper encoded rule and pass the string to other class. But using Convert::ASN1 library im able to encode only in ber/der format. Can any one of you please guide how to encode below input in uper encoding format and capture that encoded string in a variable. P.S: If require i can provide ASN1 structure of input.
#!/usr/bin/perl -w use Data::Dumper; use Getopt::Std; use Convert::ASN1 qw(:io :debug); getopts('s:D', \%opts); if (!defined($opts{'s'})) { print STDERR "Missing ASN.1 Specification file!\n"; HELP_MESSAGE(); exit 1; } $specfile = $opts{'s'}; $DEBUG = $opts{'D'}; $asn = Convert::ASN1->new(encoding=>'DER'); $r = $asn->prepare_file($specfile); #print Dumper($r); if (!defined($r)) { print "ERROR: " . $asn->error . "\n"; } $securityModeError = $asn->find("ATCmessageheader"); $pdu = $securityModeError->encode( msgidentificationnumber => 1, msgreferencenumber =>1, timestamp =>{timehours=>12, timeminutes=>07, timeseconds=>50} ); print "Encode : pdu ". Dumper($pdu), "\n"; print "Decode: pdu ". Dumper($securityModeError->decode($pdu)). "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need Convert::ASN1 library encoded text in uper format
by thanos1983 (Parson) on Feb 22, 2018 at 12:31 UTC | |
by santosh_vjit (Novice) on Feb 22, 2018 at 12:36 UTC | |
by thanos1983 (Parson) on Feb 22, 2018 at 14:13 UTC |