SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

 
 

perl-Convert-ASN1-asn1c rpm build for : OpenSuSE. For other distributions click perl-Convert-ASN1-asn1c.

Name : perl-Convert-ASN1-asn1c
Version : 0.07 Vendor : obs://build_opensuse_org/devel:languages:perl
Release : lp156.8.1 Date : 2024-07-03 17:56:24
Group : Development/Libraries/Perl Source RPM : perl-Convert-ASN1-asn1c-0.07-lp156.8.1.src.rpm
Size : 0.04 MB
Packager : https://www_suse_com/
Summary : Perl Module to Convert Asn1 to Xml and Back, Using The
Description :
Abstract Syntax Notation One (ASN1) is a protocol for data exchange by
applications, defined by the ITU-T. It works as follows: All parties agree
on a ASN1 specification for the Protocol Data Units (PDUs). Such a
specification might look like:

AARQ-apdu ::= [APPLICATION 0] IMPLICIT SEQUENCE {
application-context-name [1] Application-context-name,
sender-acse-requirements [10] IMPLICIT ACSE-requirements OPTIONAL,
calling-authentication-value [12] EXPLICIT Authentication-value OPTIONAL,
user-information [30] IMPLICIT Association-information OPTIONAL
}

Application-context-name ::= SEQUENCE { foo OBJECT IDENTIFIER }
ACSE-requirements ::= BIT STRING
Authentication-value ::= CHOICE { external [2] IMPLICIT PrivatExtPassword }
PrivatExtPassword ::= [UNIVERSAL 8] IMPLICIT SEQUENCE { encoding EncodingPassword }
...

Now every party (that is aware of this specification) can take some data
and encode it (using standardized encoding rules) - Every other party will
be able to decode the information afterwards.

A module that does exactly this is Convert::ASN1. However, this approach
has a slight problem if you just want to receive a ASN1 encoded data unit,
modify a few values and send the modified PDU somewhere, for example during
development, testing or fuzzing of ASN1 processing entities: Sometimes you
don\'t have the ASN1 specification for that device.

In that case you can try to reverse engineer it, which is error prone and
tiresome. One tool that can assist you with that is the open source ASN1
compiler asn1c. It comes with two tools, unber and enber. The unber program
takes a binary pdu and tries to decode it to xml (without a matching ASN1
specification) just using the encoding information present in the binary
ASN1 data. Due to the nature of BER-encoded (the most widely used encoding
standard) data, this is almost always possible. The only information that
might get lost is the description what kind of data we are dealing with,
i.e., if we should interpret the data with a hex value of 0x31 as an 1-byte
integer or a 1-char character string.

The enber tool can read the xml created by unber and convert it back into a
binary ASN1 pdu. Of course it is possible to edit the xml in between this
process to change some values. This is exactly what this module does.

Suppose you sniffed a data packet from somewhere (for example from a
Siemens HiPath PBX, from which you know it uses the CSTA protocol, which
itself uses ASN1 PDUs). You dumped the data in a file called
pdu-siemens.bin for analysis.

$ hexdump pdu-siemens.bin
0000000 0ca1 0102 0201 0002 30d3 0a03 0201
000000e

Now use the unber tool to decode this file:

$ unber -p pdu-siemens.bin
< C O=\"0\" T=\"[1]\" TL=\"2\" V=\"12\">
< P O=\"2\" T=\"[UNIVERSAL 2]\" TL=\"2\" V=\"1\" A=\"INTEGER\">< /P>
< P O=\"5\" T=\"[UNIVERSAL 2]\" TL=\"2\" V=\"2\" A=\"INTEGER\">�Ó< /P>
< C O=\"9\" T=\"[UNIVERSAL 16]\" TL=\"2\" V=\"3\" A=\"SEQUENCE\">
< P O=\"11\" T=\"[UNIVERSAL 10]\" TL=\"2\" V=\"1\" A=\"ENUMERATED\">< /P>
< /C O=\"14\" T=\"[UNIVERSAL 16]\" A=\"SEQUENCE\" L=\"5\">
< /C O=\"14\" T=\"[1]\" L=\"14\">

The -p option instructs unber to generate xml that enber can understand.
Now let\'s assume we want to take control over the two integer values, maybe
because we want to change their values and see what happens or we want to
examine their values in similar PDUs. We create a template with the
following content:

< C O=\"0\" T=\"[1]\" TL=\"2\" V=\"12\">
< P O=\"2\" T=\"[UNIVERSAL 2]\" TL=\"2\" V=\"1\" A=\"INTEGER\">$integer1< /P>
< P O=\"5\" T=\"[UNIVERSAL 2]\" TL=\"2\" V=\"2\" A=\"INTEGER\">$integer2< /P>
< C O=\"9\" T=\"[UNIVERSAL 16]\" TL=\"2\" V=\"3\" A=\"SEQUENCE\">
< P O=\"11\" T=\"[UNIVERSAL 10]\" TL=\"2\" V=\"1\" A=\"ENUMERATED\">< /P>
< /C O=\"14\" T=\"[UNIVERSAL 16]\" A=\"SEQUENCE\" L=\"5\">
< /C O=\"14\" T=\"[1]\" L=\"14\">

And save it as \"test-pdu.xml\". Now we can use this module to read and
create simillar PDUs.

use Convert::ASN1::asn1c;

my $pdu = \"A1 0C 02 01 01 02 02 00 D3 30 03 0A 01 02\";
$pdu =~ s/ //g;
$pdu = pack(\'H*\', $pdu);

my $conv = Convert::ASN1::asn1c->new();
my $values = $conv->decode(\"test-pdu.xml\", $pdu);
print $values->{\'integer2\'} . \"\
\"; # prints \'211\' for this example


$values->{\'integer2\'} = $conv->encode_integer(210, $values->{\'integer2_length\'});


my $pdu_new = $conv->encode(\"test-pdu.xml\", $values);

Of course this is a quick hack and not a real protocol implementation. But
quick hacks can be extremely usefull during protocol implementations. :-D

RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-C/15.6/noarch

Content of RPM  Provides Requires

Download
ftp.icm.edu.pl  perl-Convert-ASN1-asn1c-0.07-lp156.8.1.noarch.rpm
     

Provides :
perl(Convert::ASN1::asn1c)
perl-Convert-ASN1-asn1c

Requires :
perl(:MODULE_COMPAT_5.26.1)
perl(File::Slurp)
perl(File::Which)
perl(IPC::Run)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1


Content of RPM :
/usr/lib/perl5/vendor_perl/5.26.1/Convert
/usr/lib/perl5/vendor_perl/5.26.1/Convert/ASN1
/usr/lib/perl5/vendor_perl/5.26.1/Convert/ASN1/asn1c.pm
/usr/lib/perl5/vendor_perl/5.26.1/x86_64-linux-thread-multi
/usr/share/doc/packages/perl-Convert-ASN1-asn1c
/usr/share/doc/packages/perl-Convert-ASN1-asn1c/Changes
/usr/share/doc/packages/perl-Convert-ASN1-asn1c/README
/usr/share/man/man3/Convert::ASN1::asn1c.3pm.gz

 
ICM